/* @portee: admin */
/* =========================================================================
   EIT GROUP — IA métier RH (v5, agent 5) : Agenda (ag-), bandeau « Filtre appliqué par l'IA » (iacv-),
   e-mails groupés (eg-), messagerie IA (iamx-). Variables du thème uniquement (clair / sombre).
   ========================================================================= */

/* ------------------------------------------------------------ Bandeau « Filtre appliqué par l'IA » (CVthèque) */
.iacv-bandeau { display: flex; align-items: center; gap: .75rem; padding: .6rem .9rem; margin: 0 0 .1rem; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--brand-soft), transparent 70%); animation: iacv-in .35s var(--ease); flex-wrap: wrap; }
.iacv-ico { width: 2rem; height: 2rem; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--brand); color: #fff; flex-shrink: 0; box-shadow: 0 0 0 4px var(--brand-soft); }
.iacv-txt { flex: 1 1 260px; min-width: 0; }
.iacv-k { color: var(--brand-ink); text-transform: uppercase; letter-spacing: .04em; }
.iacv-v { color: var(--text); }
.iacv-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
@keyframes iacv-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.eg-bulk .ph { color: var(--brand); }

/* ------------------------------------------------------------ Agenda */
.ag-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; min-height: 0; }
.ag-main { min-height: 0; }
.ag-main.is-loading .ag-scroll { opacity: .55; transition: opacity .2s var(--ease); }
.ag-toolbar { gap: .6rem; flex-wrap: wrap; }
.ag-nav { display: flex; align-items: center; gap: .3rem; }
.ag-titre { font-size: 1.05rem; font-weight: 750; margin: 0 0 0 .4rem; text-transform: capitalize; white-space: nowrap; font-stretch: 92%; }
.ag-sources { display: flex; gap: .3rem; flex-wrap: wrap; }
.ag-src { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .6rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--text-2); font-size: .78rem; cursor: pointer; transition: all .15s var(--ease); }
.ag-src .ph { color: var(--ag-c); font-size: .95rem; }
.ag-src:hover { border-color: var(--ag-c); color: var(--text); }
.ag-src.is-off { opacity: .45; text-decoration: line-through; }
.ag-vl { margin-left: .3rem; }
.ag-scroll { padding: 0; }

.ag-month { display: flex; flex-direction: column; height: 100%; min-height: 520px; }
.ag-dow { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); background: var(--bg-sunken); }
.ag-dow span { padding: .45rem .5rem; font-size: .72rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.ag-cells { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(92px, 1fr); }
.ag-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem .35rem; display: flex; flex-direction: column; gap: .18rem; min-width: 0; overflow: hidden; }
.ag-cell:nth-child(7n) { border-right: 0; }
.ag-cell.is-out { background: var(--bg-sunken); }
.ag-cell.is-out .ag-daynum { color: var(--text-3); }
.ag-cell.is-today { box-shadow: inset 0 0 0 2px var(--brand); }
.ag-daynum { align-self: flex-start; border: 0; background: none; font-size: .78rem; font-weight: 700; color: var(--text-2); padding: .1rem .35rem; border-radius: var(--r-pill); cursor: pointer; }
.ag-cell.is-today .ag-daynum { background: var(--brand); color: #fff; }
.ag-daynum:hover { background: var(--bg-hover); }
.ag-ev { display: flex; gap: .3rem; align-items: center; width: 100%; border: 0; text-align: left; cursor: pointer; padding: .14rem .35rem; border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--ag-c) 14%, transparent); border-left: 3px solid var(--ag-c); color: var(--text); font-size: .72rem; line-height: 1.25; transition: transform .12s var(--ease), box-shadow .12s var(--ease); }
.ag-ev:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.ag-ev-h { font-weight: 700; color: var(--text-2); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.ag-ev-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-ev.is-inactif, .ag-card.is-inactif, .ag-row.is-inactif { opacity: .5; text-decoration: line-through; }
.ag-more { border: 0; background: none; color: var(--brand-ink); font-weight: 600; cursor: pointer; text-align: left; padding: 0 .35rem; }

.ag-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 100%; }
.ag-wday { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.ag-wday:last-child { border-right: 0; }
.ag-wday-h { display: flex; align-items: baseline; gap: .4rem; padding: .55rem .6rem; border-bottom: 1px solid var(--line); background: var(--bg-sunken); position: sticky; top: 0; z-index: 1; }
.ag-wday-h span { font-size: .72rem; text-transform: uppercase; color: var(--text-3); font-weight: 700; letter-spacing: .05em; }
.ag-wday-h b { font-size: 1.05rem; }
.ag-wday.is-today .ag-wday-h b { color: var(--brand-ink); }
.ag-wday.is-today { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.ag-wday-b { padding: .45rem; display: flex; flex-direction: column; gap: .4rem; }
.ag-card { display: flex; flex-direction: column; gap: .15rem; text-align: left; width: 100%; padding: .45rem .55rem; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line); border-left: 4px solid var(--ag-c); background: var(--bg-elev); color: var(--text); transition: transform .12s var(--ease), box-shadow .12s var(--ease); }
.ag-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.ag-card-h { display: flex; gap: .3rem; align-items: center; font-size: .72rem; font-weight: 700; color: var(--text-2); }
.ag-card-h .ph { color: var(--ag-c); }
.ag-card-t { font-size: .8rem; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.ag-card-d { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-vide { color: var(--text-3); text-align: center; padding: .5rem 0; }

.ag-list { padding: .4rem .8rem 1rem; }
.ag-group { margin-bottom: .6rem; }
.ag-group-h { display: flex; justify-content: space-between; align-items: center; padding: .55rem .2rem .35rem; border-bottom: 1px solid var(--line); text-transform: capitalize; position: sticky; top: 0; background: var(--bg-elev); z-index: 1; }
.ag-group-h.is-today b { color: var(--brand-ink); }
.ag-row { display: grid; grid-template-columns: 3.6rem 2rem minmax(0, 1fr) auto; align-items: center; gap: .6rem; width: 100%; padding: .5rem .3rem; border: 0; border-bottom: 1px dashed var(--line);
  background: none; text-align: left; cursor: pointer; color: var(--text); border-radius: var(--r-xs); }
.ag-row:hover { background: var(--bg-hover); }
.ag-row-time { font-weight: 700; font-size: .8rem; color: var(--text-2); }
.ag-row-ic { width: 2rem; height: 2rem; border-radius: var(--r-pill); display: grid; place-items: center; background: color-mix(in srgb, var(--ag-c) 16%, transparent); color: var(--ag-c); }
.ag-row-main { display: flex; flex-direction: column; min-width: 0; }

.ag-side { display: flex; flex-direction: column; min-height: 0; }
.ag-side .panel-header { display: flex; justify-content: space-between; align-items: center; }
.ag-side-body { padding: .6rem; display: flex; flex-direction: column; gap: .5rem; overflow-y: auto; min-height: 0; }
.ag-rap { border: 1px solid var(--line); border-left: 4px solid var(--ag-c); border-radius: var(--r-sm); padding: .55rem .6rem; background: var(--bg-elev); transition: box-shadow .15s var(--ease), transform .15s var(--ease); }
.ag-rap:hover { box-shadow: var(--shadow-1); transform: translateY(-1px); }
.ag-rap.is-paused, .ag-rap.is-done { opacity: .62; }
.ag-rap-top { display: flex; gap: .5rem; align-items: flex-start; }
.ag-rap-ic { width: 1.9rem; height: 1.9rem; border-radius: var(--r-pill); display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--ag-c) 16%, transparent); color: var(--ag-c); }
.ag-rap-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.ag-rap-txt b { overflow-wrap: anywhere; }
.ag-rap-act { display: flex; gap: .1rem; flex-shrink: 0; opacity: .55; transition: opacity .15s; }
.ag-rap:hover .ag-rap-act, .ag-rap:focus-within .ag-rap-act { opacity: 1; }
.ag-rap-meta { display: flex; flex-wrap: wrap; gap: .25rem .7rem; margin-top: .35rem; color: var(--text-2); }

.ag-form .ag-rec { margin: 1rem 0; padding: .9rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-sunken); display: flex; flex-direction: column; gap: .7rem; }
.ag-seg { display: flex; flex-wrap: wrap; gap: .3rem; }
.ag-seg label { cursor: pointer; }
.ag-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ag-seg span { display: inline-block; padding: .35rem .7rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--bg-elev); font-size: .8rem; transition: all .15s var(--ease); }
.ag-seg label.is-on span { background: var(--bg-inverse); color: var(--text-inverse); border-color: var(--bg-inverse); }
.ag-seg input:focus-visible + span { box-shadow: var(--ring); }
.ag-rec-opts { display: flex; flex-direction: column; gap: .6rem; }
.ag-form .ag-inline { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: .5rem; flex-wrap: wrap; }
.ag-inline .label { margin: 0; }
.ag-radios { display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; }
.ag-radios label { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ag-resume { margin: 0; padding: .5rem .7rem; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.ag-moi { display: inline-flex; gap: .45rem; align-items: center; font-size: .88rem; margin-bottom: .45rem; }
.ag-users { border: 1px solid var(--line); border-radius: var(--r-sm); padding: .45rem; display: flex; flex-direction: column; gap: .4rem; }
.ag-users-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .25rem; max-height: 9.5rem; overflow-y: auto; }
.ag-user { display: flex; align-items: center; gap: .4rem; padding: .25rem .35rem; border-radius: var(--r-xs); cursor: pointer; min-width: 0; }
.ag-user:hover { background: var(--bg-hover); }
.ag-user .avatar { flex-shrink: 0; }
.ag-colors { display: flex; gap: .45rem; }
.ag-color { width: 1.6rem; height: 1.6rem; border-radius: var(--r-pill); background: var(--ag-c); cursor: pointer; box-shadow: 0 0 0 2px var(--bg-elev), 0 0 0 3px transparent; transition: box-shadow .15s; }
.ag-color input { position: absolute; opacity: 0; pointer-events: none; }
.ag-color.is-on { box-shadow: 0 0 0 2px var(--bg-elev), 0 0 0 4px var(--ag-c); }
.ag-detail .modal-body .ph { color: var(--text-3); }

@media (max-width: 1279px) { .ag-grid { grid-template-columns: minmax(0, 1fr) 270px; } }
@media (max-width: 1023px) {
  .ag-grid { grid-template-columns: 1fr; }
  .ag-month { min-height: 0; }
  .ag-cells { grid-auto-rows: minmax(64px, auto); }
  .ag-ev-t { display: none; }
  .ag-ev { justify-content: center; padding: .12rem; }
  .ag-week { grid-template-columns: 1fr; }
  .ag-wday { border-right: 0; border-bottom: 1px solid var(--line); }
  .ag-wday-h { position: static; }
  .ag-vl { display: none; }
  .ag-side-body { max-height: none; }
}
@media (max-width: 480px) {
  .ag-titre { font-size: .95rem; width: 100%; margin: .2rem 0 0; }
  .ag-row { grid-template-columns: 3rem minmax(0, 1fr) auto; }
  .ag-row-ic { display: none; }
  .ag-dow span { font-size: .62rem; padding: .35rem .2rem; text-align: center; }
  .ag-cell { padding: .2rem; }
}

/* ------------------------------------------------------------ E-mails groupés : composeur */
.eg-modal { width: min(820px, calc(100vw - 24px)); }
.eg-modal .modal-header { gap: .6rem; }
.eg-steps { display: flex; align-items: center; gap: .35rem; color: var(--text-3); margin-right: auto; margin-left: .6rem; }
.eg-steps .is-on { color: var(--text); font-weight: 700; }
.eg-body { display: flex; flex-direction: column; gap: .9rem; max-height: calc(100vh - 210px); }
.eg-dest { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: var(--r); background: var(--bg-sunken); border: 1px solid var(--line); flex-wrap: wrap; }
.eg-dest-ic { width: 2.2rem; height: 2.2rem; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--bg-inverse); color: var(--text-inverse); flex-shrink: 0; }
.eg-toggle { display: inline-flex; gap: .35rem; align-items: center; cursor: pointer; }
.eg-ia { display: flex; gap: .5rem; align-items: center; padding: .5rem .6rem; border: 1px dashed var(--brand-line, var(--brand)); border-radius: var(--r); background: var(--brand-soft); }
.eg-ia > .ph { color: var(--brand); font-size: 1.1rem; }
.eg-ia .input { flex: 1; min-width: 0; background: var(--bg-elev); }
.eg-lang { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); }
.eg-lang button { border: 0; background: none; padding: .45rem .7rem; font-size: .85rem; color: var(--text-2); border-bottom: 2px solid transparent; cursor: pointer; display: inline-flex; gap: .3rem; align-items: center; }
.eg-lang button.is-on { color: var(--text); border-bottom-color: var(--brand); font-weight: 650; }
.eg-msg { min-height: 9rem; resize: vertical; font-family: inherit; line-height: 1.5; }
.eg-vars { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.eg-var { cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; }
.eg-var:hover { border-color: var(--brand); color: var(--brand-ink); }
.eg-opts { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.eg-opt { display: flex; gap: .55rem; align-items: flex-start; flex: 1 1 320px; cursor: pointer; }
.eg-opt small { display: block; font-size: .75rem; line-height: 1.35; }
.eg-langue { flex: 0 1 240px; margin: 0; }
.eg-big { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.eg-big b { font-size: 2.2rem; line-height: 1; font-weight: 800; font-stretch: 90%; color: var(--brand-ink); }
.eg-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1rem; }
.eg-col { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.eg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; max-height: 14rem; overflow-y: auto; }
.eg-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .45rem; align-items: center; padding: .2rem .3rem; border-radius: var(--r-xs); }
.eg-list li:nth-child(odd) { background: var(--bg-sunken); }
.eg-excl { display: flex; flex-direction: column; padding: .4rem .55rem; border-radius: var(--r-sm); background: var(--warning-soft); color: var(--text); }
.eg-excl .ph { color: var(--warning); }
.eg-mail { border: 1px solid var(--line); border-radius: var(--r); padding: .8rem .9rem; background: var(--bg-elev); box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: .5rem; }
.eg-mail-obj { padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.eg-mail-txt, .eg-pre { white-space: pre-wrap; line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 720px) { .eg-cols { grid-template-columns: 1fr; } .eg-steps { display: none; } .eg-ia { flex-wrap: wrap; } .eg-ia .btn { width: 100%; } .eg-body { max-height: calc(100vh - 170px); } }

/* ------------------------------------------------------------ E-mails groupés : historique */
.eg-tr { cursor: pointer; }
.eg-clip { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eg-prog { display: flex; align-items: center; gap: .45rem; white-space: nowrap; }
.eg-prog .cv-meter { width: 90px; }
.eg-drawer { width: min(720px, 100%); }
.eg-drawer .drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.eg-drawer .drawer-body { padding: 1rem 1.2rem; overflow-y: auto; flex: 1; }
.eg-counters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; }
.eg-counters > div { display: flex; flex-direction: column; padding: .55rem .6rem; border-radius: var(--r-sm); background: var(--bg-sunken); }
.eg-counters b { font-size: 1.3rem; }
.eg-msg-box summary { cursor: pointer; }
.eg-lignes td { vertical-align: top; }
@media (max-width: 600px) { .eg-counters { grid-template-columns: repeat(3, minmax(0, 1fr)); } .eg-clip { max-width: 22ch; } }

/* ------------------------------------------------------------ Messagerie : IA */
.iamx-btn { color: var(--brand); }
.iamx-btn.is-loading { animation: iamx-pulse 1s infinite; }
@keyframes iamx-pulse { 50% { opacity: .35; } }
.iamx-box { position: fixed; z-index: 260; right: 16px; bottom: 88px; width: min(420px, calc(100vw - 32px)); max-height: 60vh; display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: iacv-in .25s var(--ease); }
.iamx-head { display: flex; align-items: center; gap: .5rem; padding: .65rem .8rem; border-bottom: 1px solid var(--line); }
.iamx-head > .ph { color: var(--brand); }
.iamx-title { flex: 1; font-size: .9rem; }
.iamx-body { padding: .8rem .9rem; overflow-y: auto; white-space: pre-wrap; line-height: 1.5; }
