/* Console v3 : Bibliothèque › Voix et Cerveaux (console-v3-catalog.js) et
   tableau de la page Services (console-v3-services.js, préfixe .v3s-). Préfixe .v3c-. */

.v3c { display: grid; gap: 14px; }
.v3c .v3-lead { margin: 0; }
.v3c-rule { margin: 0; padding: 10px 14px; border-left: 3px solid var(--accent, #254EBC); border-radius: 0 10px 10px 0; background: var(--surface-soft); color: var(--ink); font-size: 13.5px; line-height: 1.5; }
.v3c-readonly { margin: 0; }
.v3c-panels { display: grid; gap: 10px; }
.v3c-footer { margin: 4px 0 0; }

/* Panneau d'un service */
.v3c-panel { padding: 0; overflow: hidden; transition: border-color .15s; }
.v3c-panel.is-open { border-color: var(--line-strong); }
.v3c-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 58px; }
.v3c-toggle { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: 10px; padding: 4px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.v3c-toggle:focus-visible { outline: 2px solid var(--accent, #254EBC); outline-offset: 4px; border-radius: 6px; }
.v3c-static { cursor: default; }
.v3c-chevron { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.v3c-chevron-space { flex: none; width: 18px; }
.is-open > .v3c-head .v3c-chevron { transform: rotate(90deg); }
.v3c-title { display: grid; min-width: 0; gap: 2px; }
.v3c-title strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.v3c-title small { color: var(--muted); font-size: 12.5px; }
.v3c-title small:empty { display: none; }
.v3c-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.v3c-pills:empty { display: none; }
.v3c-switch { flex: none; }
.v3c-switch:disabled { cursor: not-allowed; opacity: .55; }
.v3c-panel.is-off .v3c-title strong { color: var(--muted); }
.v3c-panel.is-off .v3c-list { opacity: .62; }

.v3c-body { display: grid; gap: 10px; padding: 0 16px 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.v3c-off-note { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--warning-soft); color: var(--ink); font-size: 13px; }
.v3c-lines { display: grid; gap: 4px; padding: 0 16px 14px 44px; margin-top: -4px; }
.v3c-line { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.v3c-line a { color: var(--accent, #254EBC); font-weight: 600; }

/* Cerveaux grisés : bientôt, ou à brancher */
.v3c-soon .v3c-title strong, .v3c-todo .v3c-title strong { color: var(--muted); }
.v3c-soon { background: var(--surface-muted); }
.v3c-todo .v3c-head > .button { flex: none; }

/* Recherche et filtres */
.v3c-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.v3c-search { flex: 1 1 220px; }
.v3c-search input, .v3c-select select { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.v3c-search input:focus, .v3c-select select:focus { outline: 2px solid var(--accent, #254EBC); outline-offset: 1px; border-color: transparent; }
.v3c-select { flex: 0 1 190px; }
.v3c-shown { margin: 0; color: var(--muted); font-size: 12.5px; }

/* Liste des voix : bornée en hauteur, défile dans le panneau */
.v3c-list { display: grid; max-height: min(62vh, 560px); margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 10px; list-style: none; }
.v3c-models { max-height: none; }
.v3c-row, .v3c-group { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 12px; border-bottom: 1px solid var(--line); content-visibility: auto; contain-intrinsic-size: auto 40px; }
.v3c-list > li:last-child { border-bottom: 0; }
.v3c-group { position: sticky; top: 0; z-index: 1; background: var(--surface-soft); }
.v3c-group strong { font-size: 13px; }
/* Le fabricant des voix, au-dessus de ses langues. */
.v3c-provider { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 10px 12px 6px; border-bottom: 1px solid var(--line); }
.v3c-provider strong { color: var(--muted); font-size: 12px; letter-spacing: .03em; text-transform: uppercase; }
.v3c-group-count { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.v3c-check { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: 10px; cursor: pointer; }
.v3c-check input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--accent, #254EBC); cursor: pointer; }
.v3c-check input:disabled { cursor: not-allowed; }
.v3c-row-name { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.v3c-tags { display: flex; flex: none; gap: 4px; }
.v3c-tag { padding: 2px 7px; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.v3c-listen, .v3c-listen-none { flex: none; width: 30px; height: 30px; }
.v3c-listen { display: grid; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; transition: background-color .15s, border-color .15s; }
.v3c-listen svg { width: 13px; height: 13px; margin-left: 2px; fill: currentColor; }
.v3c-listen:hover { border-color: var(--accent, #254EBC); color: var(--accent, #254EBC); }
.v3c-listen:focus-visible { outline: 2px solid var(--accent, #254EBC); outline-offset: 2px; }
.v3c-more { display: flex; justify-content: center; padding: 10px; }
.v3c-empty { padding: 14px; color: var(--muted); font-size: 14px; }
.v3c-error-text { margin: 0 0 10px; }

/* Services v3 : un tableau, une ligne par clé, un menu « ⋯ » par clé branchée
   (choix de Johann du 24/11/2026, « A, le tableau »). Préfixe .v3s-. */
.v3s-services { display: grid; gap: 16px; }
.v3s-lead { margin: 0; max-width: 760px; }
.v3s-lead a, .v3s-minutes a, .v3s-offered a { color: var(--action); font-weight: 500; }
.v3s-lead a:hover, .v3s-minutes a:hover, .v3s-offered a:hover { color: var(--action-hover); text-decoration: underline; }
/* Pas d'overflow sur le cadre : les menus « ⋯ » en sortent sans être coupés. */
.v3s-table-wrap { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.v3s-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.v3s-table th, .v3s-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.v3s-table thead th { padding: 10px 16px; border-bottom-color: var(--line-strong); background: var(--stone-50); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.v3s-table thead th:first-child { border-top-left-radius: 9px; }
.v3s-table thead th:last-child { border-top-right-radius: 9px; }
.v3s-table tbody:last-child tr:last-child > * { border-bottom: 0; }
.v3s-col-provider { width: 22%; }
/* Les colonnes courtes prennent la largeur de leur contenu ; la clé prend le reste. */
.v3s-col-role, .v3s-col-state, .v3s-col-actions { width: 1%; }
.v3s-provider { font-weight: 400; }
.v3s-provider.has-keys { border-right: 1px solid var(--line); }
.v3s-provider-name { display: block; color: var(--ink); font-weight: 600; }
.v3s-provider-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.v3s-minutes { display: flex; flex-direction: column; gap: 2px; }
.v3s-key-name { display: block; color: var(--ink); }
.v3s-key-name.is-quiet, .v3s-row.is-muted .v3s-key-name { color: var(--muted); }
.v3s-key-sub, .v3s-state-note { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.v3s-offered { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 6px 0 0; font-size: 13px; line-height: 1.45; }
.v3s-offered span { color: #8A5200; }
.v3s-role { display: block; color: var(--ink); line-height: 1.6; white-space: nowrap; }
.v3s-state { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); white-space: nowrap; }
.v3s-dot { flex: none; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.v3s-state.is-included .v3s-dot { background: var(--action); }
.v3s-state.is-failing .v3s-dot { background: var(--warning); }
.v3s-state.is-none, .v3s-state.is-soon { color: var(--muted); }
.v3s-state.is-none .v3s-dot, .v3s-state.is-soon .v3s-dot { border: 1.5px solid var(--stone-400, #9C978C); background: transparent; }
.v3s-table td.v3s-act { padding-top: 4px; padding-bottom: 4px; text-align: right; white-space: nowrap; }
.v3s-act .v3s-link { margin-top: 6px; }
.v3s-link { padding: 4px 2px; border: 0; background: none; color: var(--action); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.v3s-link:hover { color: var(--action-hover); text-decoration: underline; }
.v3s-link:focus-visible, .v3s-menu > summary:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; border-radius: 6px; }
/* Le menu « ⋯ » : celui des avatars (fermeture au clic dehors et à Échap par console.js). */
.v3s-menu { display: inline-block; margin-left: 0; text-align: left; }
.v3s-menu > summary { cursor: pointer; }
.v3s-menu .avatar-actions-list { min-width: 210px; padding: 6px 0; border-color: var(--line-strong); box-shadow: 0 8px 28px rgba(18, 18, 16, .12); }
.v3s-menu .avatar-actions-list .button { min-height: 40px; padding: 0 14px; border-radius: 0; color: var(--ink); font-weight: 400; }
.v3s-menu .avatar-actions-list .button:hover { background: var(--surface-muted); }
.v3s-menu .avatar-actions-list .button.text-danger { color: var(--danger); }
.v3s-menu-sep { height: 1px; margin: 6px 0; border: 0; background: var(--line); }
.v3s-listening { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; }
.v3s-listening svg { flex: none; }
.v3s-more { margin: 0; }
/* Phrase sous le tableau : LiveKit et Pipecat se paramètrent à la création du projet (lien vers Projets). */
.v3s-integ { max-width: 760px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.v3s-integ strong { color: var(--ink); font-weight: 700; }
.v3s-integ a { color: var(--action); font-weight: 500; }
.v3s-integ a:hover { color: var(--action-hover); text-decoration: underline; }
/* Connexion Realtime personnelle (administrateur seulement), sous le tableau. */
.v3s-admin { display: grid; gap: 12px; margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line-strong); }
.v3s-admin-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.v3s-admin-title { margin: 0; font-size: 16px; font-weight: 600; }
.v3s-tag { padding: 2px 8px; border-radius: 4px; background: var(--surface-muted); color: var(--muted); font-size: 12px; font-weight: 600; }
.v3s-admin-text { margin: 0; color: var(--muted); font-size: 14px; }
.v3s-settings { margin: 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); list-style: none; }
.v3s-settings li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-height: 48px; padding: 4px 16px; border-bottom: 1px solid var(--line); }
.v3s-settings li:last-child { border-bottom: 0; }
.v3s-settings-label { flex: 0 0 160px; color: var(--ink); }
.v3s-settings-value { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; color: var(--muted); }

/* Téléphone : chaque clé devient un petit bloc, le menu à droite, pas de défilement horizontal. */
@media (max-width: 760px) {
  .v3s-table, .v3s-table tbody, .v3s-table tr, .v3s-table th, .v3s-table td { display: block; }
  .v3s-table thead { display: none; }
  .v3s-table tbody { border-bottom: 1px solid var(--line-strong); }
  .v3s-table tbody:last-child { border-bottom: 0; }
  .v3s-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .v3s-table tbody tr:last-child { border-bottom: 0; }
  .v3s-table th, .v3s-table td { grid-column: 1; padding: 0; border: 0; }
  .v3s-table .v3s-provider { padding-bottom: 8px; }
  .v3s-provider.has-keys { border-right: 0; }
  .v3s-key-cell { font-weight: 500; }
  .v3s-table td.v3s-roles { display: flex; flex-wrap: wrap; gap: 0 12px; margin-top: 4px; color: var(--muted); }
  .v3s-role { color: var(--muted); font-size: 13px; }
  .v3s-state-cell { margin-top: 6px; }
  .v3s-table td.v3s-act { grid-column: 2; grid-row: 1 / span 5; align-self: center; padding: 0; }
  .v3s-table td.v3s-act:empty { display: none; }
  .v3s-table tr:has(> .v3s-provider) > td.v3s-act { grid-row: 2 / span 4; }
  .v3s-settings-label { flex-basis: 100%; }
}

@media (max-width: 640px) {
  .v3c-head { flex-wrap: wrap; padding: 12px; }
  .v3c-toggle { flex-basis: calc(100% - 60px); }
  .v3c-pills { order: 3; justify-content: flex-start; width: 100%; padding-left: 28px; }
  .v3c-body { padding: 12px; }
  .v3c-lines { padding: 0 12px 12px; }
  .v3c-tags { display: none; }
  .v3c-select { flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .v3c-chevron, .v3c-listen, .v3c-panel { transition: none; }
}
