/* « Où placer une recrue » (V8-74, lot 16) — le podium, la jauge de branche, la feuille de décision.
   Rien que des jetons : changer les 5 couleurs d'un réseau recolore ces lignes aussi. */

.plc-settings .plc-field + .plc-field {
    margin-top: .75rem;
}

/* « Pour qui ? » (Tom Select) : « Pour moi » est une ligne de la liste, jamais un champ vide — le chevron reste
   (le dessin du select d'à côté), pas de croix ✕ qui viderait le champ. */
.plc-settings .ts-wrapper.form-select.has-items {
    background-image: var(--bs-form-select-bg-img);
}

.plc-settings .ts-wrapper .clear-button {
    display: none;
}

.plc-volume {
    margin-top: .75rem;
}

.plc-volume summary {
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    color: var(--brand-primary);
}

/* La case « Garder les branches à la limite » sous le champ des points (décision François 21/09). */
.plc-limit {
    margin-top: .6rem;
    font-size: .9rem;
}

.plc-settings-compact .plc-limit {
    margin-top: .35rem;
}

.plc-situation {
    font-size: .9rem;
    line-height: 1.6;
    color: var(--brand-text);
    margin: 0 .25rem 1rem;
}

.plc-situation > div + div {
    margin-top: .3rem;
}

.plc-situation .plc-mode {
    margin-top: .6rem;
    font-size: 1rem;
    color: var(--brand-secondary);
}

/* Le rang visé ouvre un second paragraphe ; les branches se lisent comme des puces, les plus grosses d'abord,
   une branche au plafond (points comptés < total réel) en surface douce. */
.plc-situation .plc-situation-target {
    margin-top: .7rem;
}

.plc-branches {
    margin-top: .5rem;
}

/* La feuille « le détail par branche » : un tableau serré, les nombres alignés à droite, une branche au plafond
   en surface douce ; le tableau défile en largeur dans son cadre si l'écran est trop étroit (jamais la page). */
.plc-branches-wrap {
    overflow-x: auto;
    margin: 0 -.25rem .5rem;
    max-width: 44rem; /* sur un grand écran la feuille prend toute la largeur : le tableau reste lisible, colonnes serrées */
}

.plc-branches-help {
    max-width: 44rem;
}

.plc-branches-table {
    font-size: .88rem;
    margin: 0;
    --bs-table-bg: transparent;
}

.plc-branches-table th {
    font-weight: 700;
    color: var(--brand-muted);
    white-space: nowrap;
    vertical-align: bottom;
}

.plc-branches-table th small {
    display: block;
    font-weight: 400;
    font-size: .74rem;
}

.plc-branches-table .num {
    text-align: right;
    white-space: nowrap;
}

.plc-branches-table tr.is-capped td {
    background: var(--brand-surface-soft);
}

.plc-branches-help > div + div {
    margin-top: .25rem;
}

.plc-podium {
    display: grid;
    gap: .9rem;
    margin-bottom: 1rem;
}

.plc-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-line);
    border-radius: 16px;
    padding: 1rem 1.1rem;
}

.plc-card.is-first {
    border-color: var(--brand-accent);
    box-shadow: 0 6px 20px rgba(var(--brand-accent-rgb), .14);
    padding: 1.25rem 1.2rem;
}

.plc-card.is-off {
    opacity: .75;
}

.plc-card-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .6rem;
}

.plc-rank {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--brand-primary);
    color: var(--brand-on-primary, #fff);
    font-family: var(--brand-font-display);
    font-size: 1.15rem;
    text-align: center;
    line-height: 2rem;
}

.plc-card.is-first .plc-rank {
    background: var(--brand-accent);
}

.plc-title {
    margin: 0;
    font-family: var(--brand-font-display);
    font-size: 1.2rem;
    color: var(--brand-primary);
    min-width: 0;
    word-break: break-word;
}

.plc-card.is-first .plc-title {
    font-size: 1.4rem;
}

/* Une information par ligne (règle du 14/09) : compte ? rapporte ? ouvre ? */
.plc-lines {
    list-style: none;
    margin: 0 0 .75rem;
    padding: 0;
    font-size: .92rem;
    line-height: 1.55;
}

.plc-line {
    position: relative;
    padding-left: 1.5rem;
}

.plc-line + .plc-line {
    margin-top: .3rem;
}

.plc-line::before {
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
}

.plc-line.is-on::before {
    content: '✔';
    color: var(--brand-success, var(--bs-success));
}

.plc-line.is-off::before {
    content: '✘';
    color: var(--brand-muted);
}

.plc-line.is-off {
    color: var(--brand-muted);
}

.plc-line.is-neutral::before {
    content: '—';
    color: var(--brand-muted);
}

.plc-line.is-neutral {
    color: var(--brand-muted);
}

/* La jauge de branche : le NP de la branche vers le plafond du rang visé — le plafond se voit sans se nommer. */
.plc-gauge-bar {
    height: .55rem;
    border-radius: 999px;
    background: var(--brand-surface-soft);
    overflow: hidden;
}

.plc-gauge-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: var(--brand-success, var(--bs-success));
    transition: width .4s ease;
}

.plc-gauge-fill.is-full {
    background: var(--brand-secondary);
}

.plc-gauge-text {
    font-size: .78rem;
    color: var(--brand-muted);
    margin-top: .3rem;
}

.plc-team {
    font-style: italic;
    font-size: .88rem;
    color: var(--brand-text);
    margin-top: .6rem;
}

/* Le guide « Comment l'app choisit une place » (console) : de la prose aérée, une idée par ligne. */
.plc-guide .card-body {
    font-size: .92rem;
    line-height: 1.65;
}

.plc-guide ul,
.plc-guide ol {
    padding-left: 1.25rem;
}

.plc-guide li + li {
    margin-top: .35rem;
}

/* La raison du classement (le critère qui départage la carte de sa voisine) : une ligne discrète sous les faits. */
.plc-why {
    font-size: .82rem;
    line-height: 1.5;
    color: var(--brand-muted);
    margin-top: .5rem;
}

.plc-expected {
    margin-top: .6rem;
    font-size: .88rem;
    line-height: 1.55;
    background: rgba(var(--brand-accent-rgb), .12);
    border-radius: 10px;
    padding: .6rem .8rem;
}

/* Ce qui se perd au-delà de la marge (la case « Proposer aussi les branches trop justes ») : dit en premier, en foncé. */
.plc-expected-lost {
    color: var(--brand-secondary);
    margin-bottom: .35rem;
}

.plc-decide {
    margin-top: .9rem;
    padding: .8rem 1rem;
}

.plc-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--brand-primary);
    list-style: none;
}

.plc-details summary::before {
    content: '▸ ';
}

.plc-details[open] summary::before {
    content: '▾ ';
}

.plc-details .plc-card {
    margin-bottom: .75rem;
}

.plc-rejected {
    margin: 0;
    padding-left: 1.1rem;
    font-size: .88rem;
    line-height: 1.55;
    color: var(--brand-muted);
}

.plc-rejected li + li {
    margin-top: .35rem;
}

.plc-legend {
    font-size: .88rem;
    line-height: 1.6;
}

.plc-legend > div + div {
    margin-top: .35rem;
}

/* Le code sponsor, gros et lisible d'un bloc (leçon du dossier d'inscription, recette 14/09). */
.plc-code {
    font-family: var(--brand-font-display);
    font-size: 2rem;
    letter-spacing: .04em;
    text-align: center;
    color: var(--brand-primary);
    background: var(--brand-surface-soft);
    border-radius: 12px;
    padding: .9rem 1rem;
    margin: .5rem 0 .75rem;
    overflow-x: auto;
    white-space: nowrap;
}

.plc-word {
    font-size: .95rem;
    line-height: 1.55;
    background: var(--brand-surface-soft);
    border-radius: 10px;
    padding: .7rem .9rem;
    margin-bottom: .6rem;
}

.plc-recap {
    font-size: .92rem;
    line-height: 1.6;
}

.plc-recap > div + div {
    margin-top: .3rem;
}

/* La vue « Sur mon arbre » (demande François 20/09) : l'arbre dessiné — la tête en haut, chaque filleule sous
   sa marraine, les traits entre elles. Traits en CSS (pseudo-éléments), branches en details natif, l'ensemble
   se fait glisser : un diagramme est la seule chose qui a le droit de déborder en largeur. */
.plc-tabs {
    display: flex;
    gap: .35rem;
    margin-bottom: .8rem;
}

.plc-tabs .chip {
    flex: 1;
    text-align: center;
    text-decoration: none;
    font-size: .8rem;
    padding: .5rem .75rem;
}

.plc-tree-wrap {
    margin-bottom: 1rem;
}

.plc-tree {
    overflow-x: auto;
    /* La pastille d'une carte dépasse de .55rem en haut et de .4rem à droite : le cadre qui défile la rognait
       sur la carte « Toi », tout en haut (retour François 20/09) — de l'air au-dessus et sur les côtés. */
    padding: .75rem .5rem .5rem;
    --plc-line: var(--brand-line);
    --plc-gap: 1.1rem;
}

.plc-node-children {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    margin: 0;
    padding: var(--plc-gap) 0 0;
    list-style: none;
    width: max-content;
    min-width: 100%;
}

.plc-node-children.is-root {
    padding-top: 0;
}

/* Le trait qui descend de la marraine vers la barre de ses filleules. */
.plc-node-children:not(.is-root)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: var(--plc-gap);
    border-left: 1px solid var(--plc-line);
}

.plc-node {
    position: relative;
    flex: 0 0 auto;
    padding: var(--plc-gap) .3rem 0;
    text-align: center;
}

.plc-node-children.is-root > .plc-node {
    padding-top: 0;
}

/* La barre horizontale au-dessus de chaque filleule : la moitié gauche, la moitié droite avec le trait qui descend. */
.plc-node::before,
.plc-node::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    width: 50%;
    height: var(--plc-gap);
    border-top: 1px solid var(--plc-line);
}

.plc-node::after {
    right: auto;
    left: 50%;
    border-left: 1px solid var(--plc-line);
}

.plc-node:only-child::before,
.plc-node:only-child::after {
    border-top: 0;
}

.plc-node:first-child::before,
.plc-node:last-child::after {
    border-top: 0;
}

.plc-node:first-child::after {
    border-radius: 6px 0 0 0;
}

.plc-node:last-child::before {
    border-right: 1px solid var(--plc-line);
    border-radius: 0 6px 0 0;
}

.plc-node:last-child:not(:first-child)::after {
    border-left: 0;
}

.plc-node-children.is-root > .plc-node::before,
.plc-node-children.is-root > .plc-node::after {
    display: none;
}

.plc-node-card {
    display: inline-flex;
    flex-direction: column;
    gap: .1rem;
    position: relative;
    width: 7.4rem;
    padding: .5rem .45rem;
    border: 1px solid var(--brand-line);
    border-radius: 12px;
    background: var(--brand-surface);
    color: var(--brand-text);
    text-decoration: none;
    line-height: 1.25;
}

a.plc-node-card:hover,
a.plc-node-card:focus-visible {
    border-color: var(--brand-primary);
    text-decoration: none;
}

.plc-node-card.is-selected {
    border: 2px solid var(--brand-secondary);
    box-shadow: 0 4px 14px rgba(var(--brand-accent-rgb), .14);
}

.plc-node-card.is-root {
    width: 9.5rem;
    border-color: var(--brand-accent);
    background: rgba(var(--brand-accent-rgb), .12);
}

.plc-node-card.is-off,
.plc-node-card.is-inactive,
.plc-node-card.is-none {
    opacity: .65;
}

.plc-node-card.is-client {
    width: 6rem;
    border-style: dashed;
    background: transparent;
    opacity: .7;
}

.plc-node-name {
    font-family: var(--brand-font-display);
    font-size: .92rem;
    color: var(--brand-primary);
    overflow-wrap: anywhere;
}

.plc-node-card.is-root .plc-node-name {
    font-size: 1.05rem;
}

.plc-node-rank {
    font-size: .68rem;
    color: var(--brand-muted);
}

.plc-node-pts {
    font-size: .72rem;
    font-weight: 700;
}

.plc-node-medal {
    position: absolute;
    top: -.55rem;
    right: -.4rem;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: var(--brand-accent);
    color: var(--brand-on-primary, #fff);
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.35rem;
    text-align: center;
}

.plc-node-medal.is-ok {
    background: var(--brand-surface);
    border: 1.5px solid var(--brand-primary);
    color: var(--brand-primary);
    line-height: 1.15rem;
}

.plc-node-medal.is-off {
    background: var(--brand-surface-soft);
    color: var(--brand-muted);
}

.plc-node-medal.is-inline {
    position: static;
    display: inline-block;
    vertical-align: middle;
    margin-right: .25rem;
}

/* Le pli d'une branche : un petit résumé sur le trait, ouvert = ▾, fermé = ▸. */
.plc-node-branch > summary {
    list-style: none;
    cursor: pointer;
    display: inline-block;
    margin-top: .35rem;
    padding: .1rem .5rem;
    border-radius: 999px;
    background: var(--brand-surface-soft);
    font-size: .66rem;
    color: var(--brand-muted);
}

.plc-node-branch > summary::-webkit-details-marker {
    display: none;
}

.plc-node-branch > summary::before {
    content: '▸ ';
}

.plc-node-branch[open] > summary::before {
    content: '▾ ';
}

.plc-tree-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1rem;
    margin-top: .6rem;
}

.plc-tree-place {
    margin-bottom: 1rem;
}

/* Sous l'arbre : « La place regardée » (la consultante touchée hors podium) puis « Le podium » — les trois cartes,
   toujours là ; une carte du podium touchée sur l'arbre est surlignée. */
.plc-tree-place-title {
    margin: .25rem .25rem .5rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.plc-tree-looked {
    margin-bottom: .75rem;
}

.plc-tree-podium {
    display: grid;
    gap: .9rem;
}

.plc-tree-podium-card.is-looked .plc-card {
    box-shadow: 0 0 0 3px rgba(var(--brand-accent-rgb), .35);
}

/* La page plein écran « Sur mon arbre » (demande François 20/09) : la colonne de 720 px est levée, le hero se
   fait discret, les réglages tiennent sur une ligne, la carte de la place vient à côté de l'arbre sur un grand écran. */
.app-screen:has(.plc-full) .app-main {
    max-width: none;
    padding-inline: 1rem;
}

.app-screen:has(.plc-full) .hero {
    padding-block: .9rem .8rem;
}

.app-screen:has(.plc-full) .hero h1 {
    font-size: 1.35rem;
}

.plc-tree-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem .75rem;
    margin-bottom: .5rem;
}

.plc-tree-full {
    white-space: nowrap;
}

.plc-tree-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.plc-settings-compact .card-body {
    display: grid;
    gap: .6rem 1rem;
    align-items: end;
}

.plc-settings-compact .plc-field + .plc-field {
    margin-top: 0;
}

.plc-full .plc-situation {
    margin-bottom: .8rem;
}

.plc-full-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.plc-full .plc-tree-wrap,
.plc-full .plc-tree-place {
    margin-bottom: 0;
}

.plc-full .plc-tree {
    min-height: 16rem;
    max-height: calc(100vh - 22rem);
    overflow: auto;
}

@media (min-width: 768px) {
    .plc-settings-compact .card-body {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .plc-settings-compact .plc-settings-source {
        grid-column: 1 / -1;
    }
}

@media (min-width: 992px) {
    .app-screen:has(.plc-full) .hero {
        max-width: none;
    }

    /* Le plein écran sert à la largeur de l'arbre (retour François 21/09 : « je ne veux pas les cartes à droite, je les
       veux en dessous ») : l'arbre prend toute la largeur, les cartes viennent dessous — les trois du podium côte à côte. */
    .plc-full .plc-tree-podium {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Les trois cartes font la même hauteur (retour François 21/09), le bouton reste en bas de chacune. */
    .plc-full .plc-tree-podium-card {
        display: flex;
    }

    .plc-full .plc-tree-podium-card .plc-card {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .plc-full .plc-tree-podium-card .plc-decide {
        margin-top: auto;
        padding-top: .8rem;
    }

    .plc-full .plc-tree-podium-card .plc-lines,
    .plc-full .plc-tree-podium-card .plc-gauge,
    .plc-full .plc-tree-podium-card .plc-team,
    .plc-full .plc-tree-podium-card .plc-why,
    .plc-full .plc-tree-podium-card .plc-expected {
        flex: 0 0 auto;
    }

    .plc-full .plc-tree-podium-card .plc-why {
        margin-bottom: .9rem;
    }
}
