/* Formulaire d'opération — classes .lt-* posées par templates/form/lt_form_theme.html.twig
   et templates/operation/_form.html.twig. Couleurs : teal #1a7f99 (actions), cyan #4fbbd2 (pastilles) ; champ actif : bordure gris foncé #6b7280. */

/* ── Champs ── */
.lt-label { display: block; font-size: .875rem; font-weight: 500; color: #1f2937; margin-bottom: .25rem; }
.lt-input {
    display: block; width: 100%; min-height: 36px; padding: .5rem .75rem; margin: 0;
    font-size: .875rem; line-height: 1.25rem; color: #111827; background: #fff;
    border: 1px solid #b3bac5; border-radius: .375rem; outline: none; box-shadow: none;
    -webkit-appearance: none; appearance: none; background-image: none;
}
.lt-input:focus { border-color: #6b7280; box-shadow: none; }
.lt-input::placeholder { color: #9ca3af; }
/* Champ date vide : Safari (et Chrome) y affichent un gabarit ou la date du jour comme s'il était rempli.
   « :invalid » = vide sur un champ obligatoire → on le grise comme un placeholder. */
.lt-input[type="date"]:invalid:not(:focus)::-webkit-datetime-edit { color: #9ca3af; }
.lt-input:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.lt-textarea { min-height: 96px; resize: vertical; }
.lt-input::-webkit-outer-spin-button, .lt-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* Info-bulle sur un label (label_attr data-tooltip) */
.lt-tip { position: relative; display: inline-flex; align-items: center; margin-left: .35rem; color: #4fbbd2; cursor: help; vertical-align: middle; outline: none; }
.lt-tip:hover { color: #1a7f99; }
.lt-tip-icon { width: .9rem; height: .9rem; }
.lt-tip-text {
    position: absolute; left: 50%; bottom: calc(100% + .5rem); transform: translateX(-50%) translateY(4px);
    width: max-content; max-width: 16rem; padding: .4rem .6rem; border-radius: .375rem; background: #111827; color: #fff;
    font-size: .75rem; font-weight: 400; line-height: 1.3; text-align: center; white-space: normal;
    opacity: 0; visibility: hidden; transition: opacity .15s ease, transform .15s ease; z-index: 30; pointer-events: none;
}
.lt-tip-text::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #111827; }
.lt-tip:hover .lt-tip-text, .lt-tip:focus-visible .lt-tip-text { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.lt-help { margin-top: .25rem; font-size: .75rem; line-height: 1rem; color: #6b7280; }
.lt-error { margin-top: .25rem; font-size: .75rem; line-height: 1rem; color: #dc2626; font-weight: 500; }

/* État erreur (serveur ou navigateur) : bordure rouge, libellé rouge */
.lt-input--error,
.lt-field[data-error] .lt-input,
.lt-field[data-error] .ts-wrapper .ts-control,
.lt-field[data-error] .ts-wrapper.single .ts-control { border-color: #ef4444 !important; }
.lt-field[data-error] > .lt-label { color: #b91c1c; }

/* Suffixe « M€ » */
.lt-suffix-wrap { position: relative; }
.lt-suffix-wrap .lt-input { padding-right: 2.5rem; }
.lt-suffix { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); font-size: .75rem; color: #6b7280; pointer-events: none; }

/* Cases à cocher */
.lt-field--checkbox { display: flex; flex-direction: column; align-items: flex-start; }   /* le libellé ne prend que sa largeur : zone cliquable limitée au texte */
.lt-checkbox-label { display: inline-flex; align-items: center; gap: .5rem; min-height: 36px; font-size: .875rem; font-weight: 500; color: #1f2937; cursor: pointer; }
.lt-checkbox {
    -webkit-appearance: none; appearance: none; flex-shrink: 0; margin: 0;
    width: 1.125rem; height: 1.125rem; border-radius: .25rem; border: 1px solid #9ca3af; background: #fff; cursor: pointer;
    transition: background .15s, border-color .15s;
}
.lt-checkbox:hover { border-color: #1a7f99; }
.lt-checkbox:focus-visible { outline: 2px solid #4fbbd2; outline-offset: 2px; }
.lt-checkbox:checked {
    background: #1a7f99 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 10.5l3.5 3.5L15 7'/></svg>") center / 80% no-repeat;
    border-color: #1a7f99;
}
.lt-checkbox:disabled { opacity: .5; cursor: not-allowed; }

/* Pastilles (site, statut) */
.lt-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.lt-pill-input { position: absolute; opacity: 0; width: 0; height: 0; }
.lt-pill {
    display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem;
    border: 1px solid #b3bac5; border-radius: .375rem; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    font-size: .8125rem; font-weight: 500; color: #374151; cursor: pointer; transition: background .15s, border-color .15s;
}
.lt-pill:hover { background: #f9fafb; }
.lt-pill-dot { position: relative; display: inline-block; width: .875rem; height: .875rem; border-radius: 9999px; border: 1px solid #9ca3af; background: #fff; }
.lt-pill-input:checked + .lt-pill { border-color: #1a7f99; background: #e8f6f9; color: #0e5a6e; }
.lt-pill-input:checked + .lt-pill .lt-pill-dot { border-color: #1a7f99; }
.lt-pill-input:checked + .lt-pill .lt-pill-dot::after { content: ""; position: absolute; inset: 3px; border-radius: 9999px; background: #1a7f99; }
.lt-pill-input:focus-visible + .lt-pill { outline: 2px solid #4fbbd2; outline-offset: 2px; }
.lt-pill-input:disabled + .lt-pill { opacity: .5; cursor: not-allowed; }

/* ── Blocs ── */
.lt-card { padding: 1.5rem; background: #fff; border: 1px solid #e5e7eb; border-radius: .5rem; }
.lt-card-title { font-size: 1rem; font-weight: 600; color: #1f2937; margin-bottom: 1rem; }
.lt-panel { margin-top: 1rem; padding: 1rem; border: 1px solid #4fbbd2; border-radius: .5rem; background: #fff; }
.lt-panel-title { font-size: .875rem; font-weight: 600; color: #374151; margin-bottom: .75rem; }
/* Panneaux dépliés sous la case « Cible à créer » / « Acquéreur à créer » (classe is-open posée par operation_form.js) */
.lt-dropdown { display: grid; grid-template-rows: 0fr; opacity: 0; margin-top: 0; transition: grid-template-rows .28s ease, opacity .22s ease, margin-top .28s ease; }
.lt-dropdown-inner { overflow: hidden; min-height: 0; }
.lt-dropdown.is-open { grid-template-rows: 1fr; opacity: 1; margin-top: 1rem; }
.lt-dropdown .lt-panel { margin-top: 0; }
.lt-dropdown .lt-panel-title.mb-0 { margin-bottom: 0; }
.lt-panel-x { border: 0; background: none; padding: 0 .25rem; font-size: 1.375rem; line-height: 1; color: #6b7280; cursor: pointer; }
.lt-panel-x:hover { color: #111827; }
@media (prefers-reduced-motion: reduce) { .lt-dropdown { transition: none; } }
.lt-summary { padding: .75rem 1rem; border-radius: .375rem; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: .875rem; }
.lt-summary a:hover { text-decoration: underline; }

/* Structures représentées */
.lt-tag { display: inline-block; padding: .25rem .75rem; border: 1px solid #b3bac5; border-radius: .375rem; background: #fff; font-size: .65rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: #374151; }
.lt-tag--primary { background: #1a7f99; border-color: #1a7f99; color: #fff; }

/* Liens « + Ajouter … », boutons « retirer » */
.lt-link-add { display: inline-flex; align-items: center; gap: .375rem; padding: 0; border: 0; background: none; font-size: .875rem; font-weight: 500; color: #1a7f99; cursor: pointer; }
.lt-link-add:hover { text-decoration: underline; }
.lt-remove { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 36px; border: 1px solid #b3bac5; border-radius: .375rem; background: #fff; color: #6b7280; font-size: 1.25rem; line-height: 1; cursor: pointer; }
.lt-remove:hover { color: #dc2626; border-color: #fca5a5; }
.lt-remove--compact { width: 2rem; height: 36px; font-size: 1.125rem; margin-top: 1.5rem; }
.lt-collection { display: flex; flex-direction: column; gap: .75rem; }
/* Une cellule de grille ou de flex ne doit jamais s'élargir au-delà de sa colonne à cause d'un libellé long (nom d'entité…) :
   le texte est tronqué (ellipsis) au lieu de recouvrir la colonne voisine */
.lt-field, .lt-collection-row, .lt-collection-row > * { min-width: 0; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper { min-width: 0; max-width: 100%; }
.lt-collection-row:first-child .lt-remove { visibility: hidden; }

/* Boutons de pied */
.lt-btn-primary { display: inline-flex; align-items: center; padding: .375rem 1rem; border: 1px solid transparent; border-radius: .375rem; background: #1a7f99; color: #fff; font-size: .8125rem; line-height: 1.25rem; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); cursor: pointer; }
.lt-btn-primary:hover { background: #156a80; }
.lt-btn-primary:disabled { opacity: .6; cursor: not-allowed; }   /* envoi en cours : même taille, même libellé */
.lt-btn-secondary { display: inline-flex; align-items: center; padding: .375rem 1rem; border: 1px solid #b3bac5; border-radius: .375rem; background: #fff; color: #374151; font-size: .8125rem; line-height: 1.25rem; font-weight: 500; }
.lt-btn-secondary:hover { background: #f9fafb; }

/* ── Tom Select, aligné sur les champs texte (36 px). Les !important répondent aux surcharges globales
   de admin.css (.ts-wrapper.single .ts-control …), chargé sur toutes les pages. ── */
:is([data-operation-form], [data-lt-form]) .ts-wrapper { width: 100%; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper .ts-control,
:is([data-operation-form], [data-lt-form]) .ts-wrapper.single .ts-control {
    min-height: 36px !important; padding: 6px 2rem 6px .75rem !important; border: 1px solid #b3bac5 !important; border-radius: .375rem !important;
    font-size: .875rem !important; line-height: 1.25rem; color: #111827; background: #fff !important; box-shadow: none !important;
}
:is([data-operation-form], [data-lt-form]) .ts-wrapper.single .ts-control:hover { border-color: #9ca3af !important; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper.focus .ts-control,
:is([data-operation-form], [data-lt-form]) .ts-wrapper.single.focus .ts-control { border-color: #6b7280 !important; box-shadow: none !important; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper.single.dropdown-active .ts-control { border-bottom-color: #b3bac5 !important; border-radius: .375rem !important; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper.disabled .ts-control { background: #f3f4f6 !important; color: #9ca3af; cursor: not-allowed !important; opacity: 1; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper.disabled .ts-control .item { color: #9ca3af; }
:is([data-operation-form], [data-lt-form]) .ts-control .item { line-height: 1.25rem; }
/* Liste à choix unique : une valeur ou un placeholder trop long est tronqué (…) au lieu de passer sur deux lignes */
:is([data-operation-form], [data-lt-form]) .ts-wrapper.single .ts-control { flex-wrap: nowrap !important; overflow: hidden; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper.single .ts-control .item { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Liste statique (sans champ de recherche) : l'input fantôme de Tom Select ne doit pas réserver de largeur (min-width 7rem) */
:is([data-operation-form], [data-lt-form]) .ts-wrapper.single:not(.ts-autocomplete) .ts-control > input { position: absolute; left: -10000px; width: 0 !important; min-width: 0 !important; opacity: 0; }
:is([data-operation-form], [data-lt-form]) .ts-control .item[data-value=""] { font-size: .8rem !important; color: #9ca3af !important; }
:is([data-operation-form], [data-lt-form]) .ts-control > input { font-size: .875rem !important; }
:is([data-operation-form], [data-lt-form]) .ts-control > input::placeholder { color: #9ca3af; font-size: .8rem; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper .ts-dropdown {
    margin-top: 4px !important; border: 1px solid #b3bac5 !important; border-radius: .375rem !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08) !important; font-size: .875rem;
}
:is([data-operation-form], [data-lt-form]) .ts-wrapper .ts-dropdown .option { padding: .5rem .75rem !important; font-size: .875rem !important; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper .ts-dropdown .option[data-value=""] { display: none; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper .ts-dropdown .option:hover,
:is([data-operation-form], [data-lt-form]) .ts-wrapper .ts-dropdown .option.active { background-color: #e8f6f9 !important; color: #0e5a6e !important; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper .ts-dropdown .option.selected { background-color: #fff !important; color: #111827 !important; font-weight: normal !important; position: relative; padding-right: 1.75rem !important; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper .ts-dropdown .option.selected.active { background-color: #e8f6f9 !important; }
:is([data-operation-form], [data-lt-form]) .ts-wrapper .ts-dropdown .option.selected::after {
    content: ""; position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%231a7f99'><path fill-rule='evenodd' d='M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z' clip-rule='evenodd'/></svg>") center / contain no-repeat;
}
:is([data-operation-form], [data-lt-form]) .ts-dropdown .no-results { padding: .5rem .75rem; color: #6b7280; }

/* Autocomplétion société : pas de chevron, champ de saisie visible, items multiples en étiquettes plates (croix à gauche) */
:is([data-operation-form], [data-lt-form]) .ts-autocomplete.ts-wrapper .ts-control::after { display: none; }
:is([data-operation-form], [data-lt-form]) .ts-autocomplete.ts-wrapper.multi .ts-control > div,
:is([data-operation-form], [data-lt-form]) .ts-autocomplete.ts-wrapper.multi .ts-control [data-value] {
    display: inline-flex; align-items: center; gap: .3rem; margin: 1px .3rem 1px 0;
    /* le plugin remove_button force padding-right: 0, d'où le !important */
    padding: 0 .5rem 0 .35rem !important;
    background: #4fbbd2 !important; color: #fff !important; border: 1px solid #4fbbd2 !important; border-radius: .3rem;
    box-shadow: none !important; text-shadow: none !important; background-image: none !important;
    font-size: .75rem !important; line-height: 1.2rem !important; font-weight: 500;
}
:is([data-operation-form], [data-lt-form]) .ts-autocomplete.ts-wrapper.multi .ts-control [data-value].active {
    background: #3aa9c2 !important; color: #fff !important; border-color: #3aa9c2 !important;
}
:is([data-operation-form], [data-lt-form]) .ts-autocomplete.ts-wrapper.multi .ts-control [data-value] .remove {
    order: -1; position: static; display: inline-flex; align-items: center; justify-content: center;
    width: .85rem; height: .85rem; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 9999px;
    color: #fff; font-size: .8rem; line-height: 1; text-decoration: none; opacity: .85;
}
:is([data-operation-form], [data-lt-form]) .ts-autocomplete.ts-wrapper.multi .ts-control [data-value] .remove:hover { background: rgba(255, 255, 255, .3); color: #fff; opacity: 1; }
:is([data-operation-form], [data-lt-form]) .ts-autocomplete.ts-wrapper.multi.disabled .ts-control [data-value] { background: #f3f4f6 !important; color: #9ca3af !important; border-color: #e5e7eb !important; }
