/* L'onglet Agents : le crédit API, la dépense jour par jour, les agents par app, les alertes et le frein. DA Givre. */
.sv-ag { display: grid; gap: var(--s-5); }
.sv-ag .card { padding: var(--s-5); }
.sv-ag-compte { display: grid; gap: var(--s-4); }
.sv-ag-compte + .sv-ag-compte { padding-top: var(--s-5); border-top: 1px solid var(--line); }
.sv-ag-compte__tete { display: flex; align-items: center; gap: var(--s-3); }
.sv-ag-compte__tete h2 { margin: 0; font-size: 1.25rem; display: grid; }
.sv-ag-compte__tete h2 small { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); }
.sv-ag-avatar--cle { --app: var(--gold); }
.sv-ag-vide { display: flex; gap: var(--s-3); align-items: flex-start; color: var(--text-2); }
.sv-ag-vide p { margin: 4px 0 0; font-size: var(--fs-xs); }
.sv-ag-titre { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-md, 1rem); margin: 0 0 var(--s-4); flex-wrap: wrap; }
.sv-ag-titre small { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); margin-left: auto; }
.sv-ag-note { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-xs); margin: var(--s-3) 0 0; }

.sv-ag-source { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); font-size: var(--fs-sm, 0.86rem); line-height: 1.45; }
.sv-ag-source svg { flex: none; margin-top: 2px; }
.sv-ag-source--ok { background: var(--ok-soft); color: var(--text); }
.sv-ag-source--ok svg { color: var(--ok); }
.sv-ag-source--warn { background: var(--warn-soft); color: var(--text); }
.sv-ag-source--warn svg { color: var(--warn); }
.sv-ag-source__corps { display: grid; gap: var(--s-2); min-width: 0; flex: 1; }
.sv-ag-source__corps small { font-size: 0.7rem; }
.sv-ag-solde { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.sv-ag-solde label { display: flex; gap: var(--s-2); align-items: center; font-size: var(--fs-xs); color: var(--text-2); }
.sv-ag-solde__champ { width: 96px; min-height: 32px; padding: 0 var(--s-3); border-radius: var(--r-sm); font-variant-numeric: tabular-nums; }

.sv-ag-haut { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s-5); }
.sv-ag-credit { display: flex; gap: var(--s-5); align-items: center; }
.sv-ag-credit__texte { min-width: 0; flex: 1; }
.sv-ag-credit__ligne { display: flex; align-items: baseline; gap: var(--s-2); flex-wrap: wrap; }
.sv-ag-credit__reste { font-size: clamp(2.2rem, 5vw, 3.2rem); letter-spacing: -0.03em; line-height: 1; }
.sv-ag-credit__periode { color: var(--muted); font-size: var(--fs-xs); margin: var(--s-2) 0 var(--s-4); display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.sv-ag-suppose { display: inline-flex; gap: 4px; align-items: center; color: var(--warn); font-weight: 600; }
.sv-ag-credit__chiffres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.sv-ag-chiffre { display: grid; gap: 2px; }
.sv-ag-chiffre small { color: var(--muted); font-size: var(--fs-xs); }
.sv-ag-chiffre strong { font-size: 1.05rem; }
.sv-ag-chiffre em { color: var(--muted); font-style: normal; font-size: 0.68rem; }
.sv-ag-frein { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; margin-top: var(--s-4); font-size: var(--fs-xs); color: var(--text-2); }

.sv-ag-jours { display: flex; align-items: flex-end; gap: 3px; height: 150px; }
.sv-ag-jour { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.sv-ag-jour__barre { width: 100%; max-width: 22px; border-radius: 5px 5px 2px 2px; background: var(--gold); transition: height 0.5s ease; }
.sv-ag-jour.is-estime .sv-ag-jour__barre { background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold-line); }
.sv-ag-jour.is-auj .sv-ag-jour__barre { background: var(--info-soft); box-shadow: inset 0 0 0 1.5px var(--info); }
.sv-ag-jour small { font-size: 0.62rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.sv-ag-equipe { display: grid; gap: var(--s-3); }
/* Un bloc repliable par business (fermé par défaut, l'état est gardé dans le téléphone). */
.sv-ag .sv-ag-app { padding: 0; border-left: 3px solid var(--app); overflow: hidden; }
.sv-ag-app > summary { display: flex; align-items: center; gap: var(--s-3); min-height: 64px; padding: var(--s-3) var(--s-4); cursor: pointer; list-style: none;
  -webkit-tap-highlight-color: transparent; user-select: none; }
.sv-ag-app > summary::-webkit-details-marker { display: none; }
.sv-ag-app > summary:active { background: var(--surface-2, rgba(127, 127, 127, 0.06)); }
.sv-ag-app > summary > svg:last-child { flex: none; color: var(--muted); transition: transform var(--t-med, 0.25s) ease; }
.sv-ag-app[open] > summary > svg:last-child { transform: rotate(180deg); }
.sv-ag-app > summary .tag { white-space: nowrap; }
.sv-ag-app__nom { display: grid; min-width: 0; flex: 1; }
.sv-ag-app__nom strong { font-size: 1.05rem; }
.sv-ag-app__nom small { color: var(--muted); font-size: var(--fs-xs); line-height: 1.35; }
.sv-ag-app__visages { display: flex; flex: none; }
.sv-ag-app__visages .sv-ag-avatar + .sv-ag-avatar { margin-left: -9px; }
.sv-ag-app[open] .sv-ag-app__visages { display: none; }
.sv-ag-app > .sv-ag-grille { padding: 0 var(--s-4) var(--s-4); }
.sv-ag-logo { position: relative; width: 40px; height: 40px; flex: none; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  font-weight: 700; color: #fff; background: var(--app); }
.sv-ag-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface, #fff); }
.sv-ag-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s-4); }
.sv-ag-agent { display: grid; gap: var(--s-3); align-content: start; border-top: 3px solid var(--app); }
.sv-ag-agent.is-hors-ligne { opacity: 0.72; }
.sv-ag-agent header { display: flex; align-items: center; gap: var(--s-3); }
.sv-ag-agent header .tag { margin-left: auto; white-space: nowrap; }
.sv-ag-avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem;
  color: #fff; background: var(--app); box-shadow: 0 6px 16px -8px var(--app); position: relative; overflow: hidden; }
.sv-ag-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.sv-ag-avatar--petit { width: 28px; height: 28px; font-size: 0.75rem; box-shadow: 0 0 0 2px var(--surface, #fff); }
.sv-ag-agent.is-en-cours .sv-ag-avatar { animation: sv-ag-pense 1.6s ease-in-out infinite; }
@keyframes sv-ag-pense { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--app) 22%, transparent); } }
.sv-ag-nom { display: grid; min-width: 0; }
.sv-ag-nom small { color: var(--muted); font-size: var(--fs-xs); }
.sv-ag-quand { display: flex; gap: var(--s-2); align-items: flex-start; color: var(--text-2); font-size: var(--fs-xs); margin: 0; line-height: 1.4; }
.sv-ag-quand svg { flex: none; margin-top: 1px; }
.sv-ag-kv { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2) var(--s-3); margin: 0; }
.sv-ag-kv dt { color: var(--muted); font-size: 0.68rem; }
.sv-ag-kv dd { margin: 0; font-size: var(--fs-xs); }
.sv-ag-erreur { display: flex; gap: 6px; align-items: flex-start; margin: 0; color: var(--danger); background: var(--danger-soft); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); font-size: 0.72rem; }
.sv-ag-erreur svg { flex: none; margin-top: 1px; }
.sv-ag-modele { margin: 0; color: var(--muted); font-size: 0.66rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.sv-ag-bas { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s-5); }
.sv-ag-paliers { margin: 0; padding-left: 1.2em; display: grid; gap: var(--s-2); font-size: var(--fs-xs); }
.sv-ag-paliers li span { display: block; color: var(--text-2); }
.sv-ag-notif { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line); font-size: var(--fs-xs); display: grid; gap: var(--s-3); }
.sv-ag-notif p { margin: 0; }

@media (max-width: 980px) {
  .sv-ag-haut { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .sv-ag .card { padding: var(--s-4); }
  .sv-ag-credit { flex-direction: column; align-items: flex-start; }
  .sv-ag-credit__chiffres { grid-template-columns: 1fr 1fr; }
    .sv-ag-jours { height: 110px; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .sv-ag-agent.is-en-cours .sv-ag-avatar { animation: none; } .sv-ag-jour__barre { transition: none; } }
