﻿/* ================================================================
   Axeane UI — Traitement Document Screen CSS
   V3 CARDS design (template-v-traitement-doc reference)
   ================================================================ */

/* ═══ SHARED INPUT (compact) ═══ */
.ti {
    width: 100%; height: 32px; padding: 5px 10px; font-size: 13px; font-weight: 400;
    color: var(--ax-text); background: #fff;
    border: 1px solid var(--ax-border-input); border-radius: 5px;
    outline: none; transition: border-color .15s, box-shadow .15s;
    font-family: inherit; box-sizing: border-box;
}
.ti:hover { border-color: var(--ax-border-hover) }
.ti:focus { border-color: var(--ax-border-focus); box-shadow: 0 0 0 2.5px rgba(37, 99, 235, .10) }
.ti::placeholder { color: var(--ax-text-light); font-weight: 400 }
.ti-off { background: #f3f4f6; color: var(--ax-text-sec); cursor: not-allowed }
.ti-n { text-align: right; font-variant-numeric: tabular-nums }
.ti-sl {
    appearance: none; -webkit-appearance: none; padding-right: 26px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 6px center; background-size: 10px 7px;
    background-color: #fff;
}
.ti-sl-select {
    display: block; width: 100%; height: 30px;
    border: 1px solid var(--ax-border-input); border-radius: 5px;
    background: #fff; font-size: 13px; transition: border-color .15s;
}
.ti-sl-select:hover { border-color: var(--ax-border-hover) }
.ti-sl-select .ui-select-match-text { padding: 4px 8px; line-height: 20px }

/* ═══ INFOS COMMUNES — ONE LINE ═══ */
.td-il {
    display: flex; align-items: flex-end; gap: 10px; flex-wrap: nowrap;
    padding: 0;
}
.td-f { display: flex; flex-direction: column; gap: 3px; min-width: 0 }
.td-f label {
    font-size: 14px; font-weight: 600; color: var(--ax-text-body);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.3; margin: 0; letter-spacing: .01em;
}
.td-ig { display: flex; align-items: center; gap: 0 }
.td-ig .ti { border-radius: 5px 0 0 5px; border-right: none }
.td-igb {
    width: 32px; height: 32px; border: 1px solid var(--ax-border-input); border-left: none; border-radius: 0 5px 5px 0;
    background: #f8fafc; color: var(--ax-text-sec); cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 13px; transition: all .15s; flex-shrink: 0;
}
.td-igb:hover { background: var(--ax-primary-50); color: var(--ax-primary); border-color: var(--ax-border-focus) }

/* ═══ ACTION BUTTONS ROW ═══ */
.td-ab {
    display: flex; align-items: center; gap: 5px; flex-wrap: nowrap;
}
.td-rl {
    display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500;
    color: var(--ax-text-sec); cursor: pointer; user-select: none; margin-left: 4px;
}
.td-rl input { margin: 0; cursor: pointer }

/* ═══ V3 — FULL WIDTH (like ax-container / ax-toolbar) ═══ */
.td-v3c {
    margin: 0; background: #fff;
    border: none; border-radius: 0;
    box-shadow: none; overflow: hidden;
    border-bottom: 1px solid var(--ax-border);
}
.td-v3h { padding: 0 }
.td-v3hd {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 24px;
    border-bottom: 1px solid var(--ax-border-strong);
    background: var(--ax-card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    flex-wrap: wrap; gap: 8px;
}
.td-v3t {
    font-size: 15px; font-weight: 700; color: var(--ax-text-strong);
    display: flex; align-items: center; gap: 7px;
    white-space: nowrap;
}
.td-v3t i { color: var(--ax-primary); font-size: 15px }
.td-v3-info-zone {
    padding: 10px 24px;
    border-bottom: 1px solid var(--ax-border-light);
    background: #fff;
    cursor: default;
}
.td-v3b { margin: 0; border-radius: 0; border: none; box-shadow: none }

/* ═══ TYPE FILTER DROPDOWN ═══ */
.td-type-filter-wrap {
    position: relative; display: inline-flex; align-items: center;
}
.td-type-filter-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 12px; border-radius: var(--ax-radius-xs);
    border: 1.5px solid var(--ax-border-input);
    background: #fff; color: var(--ax-text-body);
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: all .15s; white-space: nowrap;
}
.td-type-filter-btn i.fa-filter { color: var(--ax-primary); font-size: 12px }
.td-type-filter-btn:hover { border-color: var(--ax-primary); color: var(--ax-primary); background: var(--ax-primary-50) }
.td-type-filter-btn.active { border-color: var(--ax-primary); color: var(--ax-primary); background: var(--ax-primary-50); box-shadow: 0 0 0 2px rgba(var(--ax-primary-rgb), .12) }
.td-type-filter-dd {
    display: none; position: absolute; left: 0; top: 100%; margin-top: 4px;
    min-width: 220px; padding: 4px 0; z-index: 500;
    background: var(--ax-card); border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius-sm); box-shadow: var(--ax-shadow-lg);
    list-style: none;
}
.td-type-filter-dd.open { display: block }
.td-type-filter-dd li {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 14px; font-size: 12.5px; font-weight: 500;
    color: var(--ax-text-body); cursor: pointer;
    white-space: nowrap; transition: background .1s;
}
.td-type-filter-dd li:hover { background: var(--ax-border-light); color: var(--ax-text-bold) }
.td-type-filter-dd li.active { background: var(--ax-primary-50); color: var(--ax-primary); font-weight: 600 }
.td-type-filter-dd li i { width: 14px; text-align: center; font-size: 12px; color: var(--ax-primary) }

/* ═══ SPLIT ZONE ═══ */
.td-sp {
    display: flex; min-height: 0; overflow: hidden; position: relative;
    margin: 0; border: none; border-radius: 0;
    height: calc(100vh - var(--ax-header-h, 56px) - 200px);
}
.td-lf {
    display: flex; min-height: 0; overflow-y: hidden; overflow-x: hidden;
    min-width: 0;
}
.td-rt {
    display: flex; flex-direction: column; min-height: 0; overflow: hidden; position: relative;
    background: #fafbfc; min-width: 0;
}

/* Divider */
.td-dv {
    width: 5px; background: var(--ax-border-strong); cursor: col-resize; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s; position: relative; z-index: 5;
}
.td-dv:hover { background: var(--ax-primary) }
.td-gr { width: 3px; height: 40px; background: rgba(255, 255, 255, .5); border-radius: 4px }

/* ═══ CMD BAR VERTICAL (GAUCHE) ═══ */
.td-cmd {
    display: flex; flex-direction: column; align-items: center;
    padding: 6px 3px; gap: 2px;
    background: linear-gradient(180deg, #f8f9fc, #eef0f5);
    border-right: 1px solid var(--ax-border);
    flex-shrink: 0; width: 36px;
}
.td-cb {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; cursor: pointer;
    color: var(--ax-text); font-size: 16px; border-radius: 5px;
    transition: all .15s;
}
.td-cb:hover { background: var(--ax-primary-50); color: var(--ax-primary) }
.td-cb:active { background: var(--ax-primary); color: #fff }

/* ═══ TABLE (inside split left) ═══ */
.td-li { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden }
.td-li .ax-table-footer { flex-shrink: 0 }
.td-tw { flex: 1; overflow-y: auto; overflow-x: auto; min-width: 0 }
.td-tw::-webkit-scrollbar { width: 5px; height: 5px }
.td-tw::-webkit-scrollbar-track { background: transparent }
.td-tw::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 10px }
.td-tw::-webkit-scrollbar-thumb:hover { background: #9CA3AF }

.td-t { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.45; table-layout: fixed; min-width: 680px }

/* THEAD — Modern professional header */
.td-thead-row { background: linear-gradient(180deg, #f8fafc 0%, #eef1f7 100%) }
.td-t thead th {
    font-weight: 700; text-align: left; padding: 0 8px; height: 40px;
    font-size: 13px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
    color: #475569;
    border-bottom: 2px solid var(--ax-primary-light);
    position: sticky; top: 0; z-index: 10; vertical-align: middle;
    background: linear-gradient(180deg, #f8fafc 0%, #eef1f7 100%);
}

/* Column widths */
.tc-ck { width: 34px; text-align: center !important }
.tc-ck input { margin: 0; cursor: pointer; width: 15px; height: 15px; accent-color: var(--ax-primary) }
.tc-nm { width: 44px; text-align: center !important }
.tc-cp { width: 22% }
.tc-lb { width: auto }
.tc-tr { width: 15% }
.tc-mt { width: 10%; text-align: right !important }

/* Add button inline in th */
.td-ai {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 4px; background: var(--ax-success); color: #fff;
    cursor: pointer; font-size: 12px; margin-right: 4px; transition: all .15s; vertical-align: middle;
    border: none; box-shadow: 0 1px 2px rgba(76, 175, 80, .3);
}
.td-ai:hover { background: #2e7d32; transform: scale(1.12); box-shadow: 0 2px 6px rgba(76, 175, 80, .35) }

/* TBODY — rows */
.td-t tbody tr.td-row {
    background: #fff;
    transition: background .12s ease, box-shadow .12s ease;
}
.td-t tbody tr.td-row:nth-child(even) { background: #fafbfe }
.td-t tbody tr.td-row:hover {
    background: rgba(63, 81, 181, .05) !important;
    box-shadow: inset 3px 0 0 var(--ax-primary);
}
.td-t tbody tr.td-row-sel {
    background: rgba(63, 81, 181, .08) !important;
    box-shadow: inset 3px 0 0 var(--ax-primary);
}
.td-t tbody td {
    padding: 2px 6px; height: 36px; vertical-align: middle;
    border-bottom: 1px solid #eef0f5;
    font-size: 13px; color: var(--ax-text-body);
}

/* Row number badge */
.td-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 22px; border-radius: 4px;
    background: #f1f3f9; color: var(--ax-text-sec);
    font-size: 13px; font-weight: 700;
}

/* Input inside cells */
.td-t .ti { height: 30px; font-size: 13px; border-radius: 5px }
.td-t .ti:focus { z-index: 2; position: relative; box-shadow: 0 0 0 2px rgba(37, 99, 235, .12) }

/* Th filter input */
.td-th-filter {
    height: 28px !important; font-size: 13px !important; font-weight: 600;
    border: 1px solid var(--ax-border-input); border-radius: 5px;
    padding: 3px 8px; background: #fff; color: var(--ax-text);
    width: 100%; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.td-th-filter::placeholder { color: var(--ax-primary); font-weight: 700; letter-spacing: .02em; opacity: .65; text-transform: uppercase }
.td-th-filter:focus { border-color: var(--ax-border-focus); box-shadow: 0 0 0 2px rgba(37, 99, 235, .15) }
.td-th-filter:hover:not(:focus) { border-color: var(--ax-border-hover) }

/* Compte wrapper (input + eye btn) */
.ti-cw { display: flex; align-items: center; position: relative }
.ti-cw .ti { padding-right: 28px }
.ti-eye {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    border: none; background: transparent; cursor: pointer;
    color: var(--ax-primary); font-size: 13px; padding: 2px; transition: color .15s, opacity .15s;
    opacity: .85;
}
.ti-eye:hover { color: var(--ax-primary-dark); opacity: 1 }

/* ═══ RIGHT PANEL (PDF side) — Toolbar & forms ═══ */
.td-rh {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 5px 8px; border-bottom: 1px solid var(--ax-border);
    background: #f8fafc; flex-shrink: 0; min-height: 36px;
}
.td-rh-f { display: flex; flex-direction: column; gap: 2px; min-width: 0 }
.td-rh-f .ti { height: 28px; font-size: 12.5px; padding: 2px 8px }

.td-rdel {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--ax-danger-border); background: var(--ax-danger-light);
    color: var(--ax-danger); cursor: pointer; border-radius: 5px; font-size: 14px; transition: all .15s;
}
.td-rdel:hover { background: var(--ax-danger); color: #fff }

/* ═══ PDF viewer ═══ */
.td-pv { flex: 1; display: flex; align-items: stretch; justify-content: center; background: #e8e8e8; min-height: 200px; position: relative; overflow: hidden }
.td-pvph { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; color: var(--ax-text-light) }
.td-pvph i { font-size: 48px; margin-bottom: 12px; color: var(--ax-text-muted) }
.td-pvph p { font-size: 14px; font-weight: 600; margin: 6px 0 4px; color: var(--ax-text-sec) }
.td-pvph small { font-size: 13px; color: var(--ax-text-light) }

/* ── PDF loader / spinner ── */
.pdf-loader {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 5000; font-family: inherit; color: var(--ax-primary); font-size: 14px;
}
.spinner {
    border: 4px solid #e0e0e0; border-top: 4px solid var(--ax-primary);
    border-radius: 50%; width: 50px; height: 50px;
    animation: spin 1s linear infinite; margin-bottom: 15px;
}
.loader-text { text-align: center; font-size: 14px; font-weight: 500; color: #333; }
#loaderProgress { font-size: 16px; font-weight: bold; color: var(--ax-primary); display: block; margin-bottom: 5px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ── Canvas tools ── */
.canvas-tools-wrapper {
    position: absolute; top: 54px; right: 15px; z-index: 10;
    display: flex; flex-direction: row; align-items: center; gap: 8px;
}
.canvas-tools-menu {
    display: flex; flex-direction: row; align-items: center; gap: 6px;
    opacity: 1; transform: scale(1); transform-origin: right center;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.canvas-tools-menu.hidden { opacity: 0; transform: scale(0.8); pointer-events: none; }
.tools-icon-button, .tools-toggle-icon {
    background-color: rgba(255, 255, 255, 0.15); border: 1px solid rgba(180, 180, 180, 0.4);
    border-radius: 50%; width: 32px; height: 32px; font-size: 15px;
    display: flex; justify-content: center; align-items: center; cursor: pointer;
    backdrop-filter: blur(4px); color: #333; transition: background-color 0.2s ease, transform 0.2s ease;
}
.tools-icon-button:hover, .tools-toggle-icon:hover { background-color: rgba(255, 255, 255, 0.4); transform: scale(1.05); }

/* ── Tooltip ── */
.tooltip-card-pro {
    background: #fdfaf7; border: 1px solid #e0d5c2; border-radius: 5px;
    padding: 6px 8px; font-size: 11.5px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    min-width: 140px; max-width: 200px; color: #333; font-family: inherit; line-height: 1.2;
}
.tooltip-header { display: flex; align-items: center; margin-bottom: 2px; }
.tooltip-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.tooltip-title { font-weight: 600; font-size: 11.5px; color: #2d2d2d; }
.tooltip-content div { display: flex; justify-content: space-between; margin: 1px 0; font-size: 11.5px; }
.tooltip-content strong { font-weight: 500; color: #555; margin-right: 6px; }
.tooltip-content span { font-weight: 500; color: #000; text-align: right; }

#pdfContainer { cursor: grab; overflow: auto !important; width: 100%; height: 100%; position: relative; }
#pdfContainer.dragging { cursor: grabbing !important; }
#pdfCanvas, #pdfOverlay { transition: transform 0.2s ease-in-out; transform-origin: top left; }

/* ═══ LAST ECRITURES ═══ */
.td-last-scroll { overflow-x: auto; overflow-y: auto; min-width: 0; flex-shrink: 1 }
.td-last-scroll::-webkit-scrollbar { width: 5px; height: 5px }
.td-last-scroll::-webkit-scrollbar-track { background: transparent }
.td-last-scroll::-webkit-scrollbar-thumb { background: #E5E7EB; border-radius: 10px }
.td-last-scroll::-webkit-scrollbar-thumb:hover { background: #D1D5DB }
.td-lc { background: #fff; border: 1px solid var(--ax-border); border-radius: var(--ax-radius-xs); box-shadow: var(--ax-shadow-xs); margin: 8px; overflow: hidden; min-width: 600px }
.td-lt { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 600px; table-layout: fixed; }
.td-lt th { padding: 6px 8px; background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; font-weight: 700; text-align: left; border-bottom: 1px solid var(--ax-border) }
.td-lt td { padding: 4px 8px; border-bottom: 1px solid #f1f5f9; color: var(--ax-text-body); font-size: 13px }

/* ═══ INFO SUMMARY PANEL (last ecritures header) ═══ */
.td-info-panel {
    display: flex; align-items: stretch; gap: 0; flex-wrap: nowrap;
    padding: 8px 12px; background: linear-gradient(135deg, #f8fafc 0%, #f1f4f9 100%);
    border-bottom: 1px solid var(--ax-border); flex-shrink: 0; overflow-x: auto; min-width: 600px;
}
.td-info-item { display: flex; flex-direction: column; gap: 2px; padding: 0 16px; flex: 1; min-width: 0; }
.td-info-lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #64748b; line-height: 1.3; }
.td-info-lbl i { color: var(--ax-primary); margin-right: 4px; font-size: 12px; }
.td-info-val { font-size: 13px; font-weight: 600; color: var(--ax-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-info-val-accent { color: var(--ax-primary); font-weight: 700; }
.td-info-val-solde { color: var(--ax-success-text); font-weight: 700; }
.td-info-sep { width: 1px; align-self: stretch; margin: 6px 0; background: var(--ax-border); flex-shrink: 0; }

/* ═══ LAST ECRITURES ACTION BUTTONS ═══ */
.td-lec-acts { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.td-ra {
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 12px;
    transition: all .18s; outline: none;
}
.td-ra:active { opacity: .75 }
.td-ra-edit { background: var(--ax-info-light); color: var(--ax-info); border-color: rgba(var(--ax-info-rgb, 59, 130, 246), .25) }
.td-ra-edit:hover { background: var(--ax-info); color: #fff; border-color: var(--ax-info) }
.td-ra-del { background: var(--ax-danger-light); color: var(--ax-danger); border-color: rgba(var(--ax-danger-rgb, 239, 68, 68), .25) }
.td-ra-del:hover { background: var(--ax-danger); color: #fff; border-color: var(--ax-danger) }

/* ═══ HINT CHIP (OCR) ═══ */
.hint-chip {
    background: #fffbeb; border: 1px solid #fcd34d; color: #92400e;
    padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 500;
    box-shadow: 0 2px 10px rgba(251, 191, 36, .15); transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0; transform: translateY(-8px);
}
.hint-chip.show { opacity: 1; transform: translateY(0); }

/* ═══ TOTAUX ═══ */
:root { --ax-totaux-h: 54px; }
.pl-page-has-totaux { padding-bottom: calc(var(--ax-totaux-h, 54px) + 12px) !important }

/* ═══ TOOLBAR SPACER ═══ */
.td-rh-spacer { flex: 1 }

/* ═══ FIXED EDGE BUTTONS ═══ */

/* Left edge — Journals shortcut */
.td-fixed-left {
    position: fixed; left: 0; top: 50%;
    transform: translateY(-50%);
    z-index: 1200;
    width: 28px; height: 72px;
    display: flex; align-items: center; justify-content: center;
    background: var(--ax-primary); color: #fff;
    border-radius: 0 8px 8px 0;
    cursor: pointer; font-size: 15px;
    box-shadow: 2px 0 8px rgba(0,0,0,.18);
    transition: width .2s, background .15s;
    writing-mode: vertical-rl; letter-spacing: .04em;
}
.td-fixed-left:hover { width: 34px; background: var(--ax-primary-dark) }

/* Right edge — OCR + new-window */
.td-fixed-right {
    position: fixed; right: 0; top: 50%;
    transform: translateY(-50%);
    z-index: 1200;
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding: 6px 4px;
    background: #1e293b; border-radius: 10px 0 0 10px;
    box-shadow: -2px 0 10px rgba(0,0,0,.22);
}

/* Drag handle inside fixed-right */
.td-fixed-drag {
    display: flex; align-items: center; justify-content: center;
    gap: 1px; color: rgba(255,255,255,.45); cursor: grab;
    font-size: 12px; padding: 2px 4px; border-radius: 4px;
    transition: color .15s;
}
.td-fixed-drag:hover { color: rgba(255,255,255,.8) }
.td-fixed-drag:active { cursor: grabbing }

/* Fixed-right buttons */
.td-fixed-rb {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 7px;
    background: rgba(255,255,255,.1); color: #fff;
    cursor: pointer; font-size: 14px;
    transition: background .15s, transform .1s;
}
.td-fixed-rb:hover { background: rgba(255,255,255,.22); transform: scale(1.08) }
.td-fixed-rb:active { transform: scale(.95) }

.td-fixed-rb-danger { color: #fca5a5 }
.td-fixed-rb-danger:hover { background: rgba(239,68,68,.25); color: #ef4444 }

.td-fixed-rb-success { color: #86efac }
.td-fixed-rb-success:hover { background: rgba(34,197,94,.25); color: #22c55e }

/* ================================================================
   FIX â€” ui-select dans les cellules .td-t (Ã©criture : TrÃ©sorerie,
   etc.) qui dÃ©borde aprÃ¨s sÃ©lection.
   ----------------------------------------------------------------
   Cause : <ui-select> rend un <div.ui-select-container> qui ne
   contient aucune contrainte de largeur par dÃ©faut. AprÃ¨s
   sÃ©lection, le .ui-select-match-text affiche le libellÃ© complet
   (souvent long : "Caisse principale de l'entreprise", etc.) et
   fait dÃ©border le contenu visuellement hors de la cellule
   (la cellule garde sa largeur grÃ¢ce Ã  table-layout:fixed mais
   le texte visuel sort).
   Fix : contraindre le ui-select Ã  width:100% du parent, ajouter
   ellipsis sur le match-text, et masquer le dÃ©bordement de la td.
   ----------------------------------------------------------------
   ComplÃ©ment : alignement vertical stable entre mode "fermÃ©"
   (.ui-select-match .btn) et mode "ouvert" (input.ui-select-search).
   Sans Ã§a, ouvrir le ui-select dÃ©calait l'input vers le haut de
   quelques pixels car les deux Ã©lÃ©ments n'avaient pas la mÃªme
   hauteur / padding.
   ================================================================ */

/* Hauteur de rÃ©fÃ©rence = 30px (identique Ã  .td-t .ti ci-dessus) */
.td-t tbody td .ui-select-container {
    width: 100% !important;
    max-width: 100%;
    display: block;
    height: 30px;
    line-height: 30px;
    box-sizing: border-box;
}

.td-t tbody td.tc-tr,
.td-t tbody td .ui-select-container .ui-select-match,
.td-t tbody td .ui-select-container .ui-select-match .btn {
    max-width: 100%;
    overflow: hidden;
}

/* Le bouton "match" (mode fermÃ©) â€” mÃªmes dimensions que .ti */
.td-t tbody td .ui-select-container .ui-select-match {
    display: block;
    width: 100%;
    height: 30px;
    line-height: 30px;
}

.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle {
    width: 100%;
    height: 30px;                 /* â‰¡ .ti */
    min-height: 30px;
    max-height: 30px;
    line-height: 1;               /* Ã©vite la double ligne */
    padding: 0 28px 0 10px;       /* place pour caret Ã  droite + cohÃ©rence avec .ti */
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
    vertical-align: middle;
    font-size: 13px;
    border-radius: 5px;
    border: 1px solid var(--ax-border-input);
    background: #fff;
}

.td-t tbody td .ui-select-container .ui-select-match .ui-select-match-text {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    line-height: 1.3;
}

/* Après sélection : verrouiller la hauteur interne du match-text
   pour qu'il ne pousse JAMAIS le bouton toggle plus haut que 30px,
   quel que soit la police / la longueur du libellé. */
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle .ui-select-match-text,
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle span.ui-select-match-text {
    height: 28px !important;         /* 30 - 2px borders du btn */
    max-height: 28px !important;
    line-height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    vertical-align: middle !important;
}

/* Caret position â€” dans le padding-right rÃ©servÃ© (28px) */
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle > .caret {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}

/* Assure position:relative pour pouvoir absolument positionner le caret */
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle {
    position: relative;
}

/* Champ de recherche (mode ouvert) â€” EXACTEMENT les mÃªmes dimensions
   que le bouton match pour Ã©viter tout dÃ©calage vertical/saut Ã 
   l'ouverture. */
.td-t tbody td .ui-select-container input.ui-select-search {
    width: 100% !important;
    max-width: 100% !important;
    height: 30px !important;      /* â‰¡ .btn.ui-select-toggle */
    min-height: 30px !important;
    max-height: 30px !important;
    line-height: 1 !important;
    padding: 0 10px !important;   /* â‰¡ .btn horizontal padding (sans le 28px du caret) */
    margin: 0 !important;
    font-size: 13px;
    border-radius: 5px;
    border: 1px solid var(--ax-border-focus, #2563eb);
    background: #fff;
    box-sizing: border-box;
    vertical-align: middle;
    display: block;
}

/* Le container .ui-select-bootstrap est une position:relative par
   dÃ©faut â€” on s'assure qu'il n'y a pas de transition sur la hauteur
   qui pourrait donner une impression de "saut". */
.td-t tbody td .ui-select-container.ui-select-bootstrap,
.td-t tbody td .ui-select-container.ui-select-bootstrap.open {
    transition: none;
}

/* ================================================================
   FIX COMPLÃ‰MENTAIRE â€” "saut" vertical de l'input Ã  l'ouverture.
   ----------------------------------------------------------------
   Causes rÃ©siduelles observÃ©es :
   1. Bootstrap .form-control applique `height: 34px` +
      `padding: 6px 12px` + `line-height: 1.42857143` â†’ l'input de
      recherche dÃ©passe 30px avant que nos rÃ¨gles :not(!important)
      puissent gagner.
   2. ui-select-bootstrap ajoute un `margin-bottom` / `border-radius`
      diffÃ©rent sur le search vs le match.
   3. En mode open, `.ui-select-match` passe en `display:none` mais
      certains CSS projet le gardent en `display:block` (ng-hide CSS
      transitions Angular) â†’ dÃ©cale l'input.
   4. Le parent <td> avec `vertical-align: middle` + height:36px
      recalcule l'alignement quand le contenu change de hauteur.

   On verrouille TOUT :
   - Hauteur + padding + border sur le search ET le match (avec
     !important sur tous les champs qui comptent visuellement).
   - `.ui-select-match` passe en display:none dÃ¨s .open (mÃªme si
     ng-hide est en transition).
   - Le <td> conserve une hauteur stable via line-height:36px.
   ================================================================ */

/* 1) Le <td> garde une hauteur stable, quoiqu'il arrive.
      Approche : padding vertical = 0, line-height "normal", et on
      laisse `vertical-align: middle` (comportement natif des <td>)
      centrer l'enfant block `.ui-select-container` (30px) dans la
      cellule de 36px. C'est le plus robuste : aucune ligne-box
      fantôme, aucun padding qui se cumule, le rendu est identique
      avant/après sélection/ouverture/fermeture. */
.td-t tbody tr.td-row > td.tc-tr,
.td-t tbody td.tc-tr {
    height: 36px !important;
    max-height: 36px !important;
    line-height: normal !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
    vertical-align: middle !important;
    overflow: hidden;
    position: relative;
}

/* 2) Placeholder injecté par ui-select — UNIQUEMENT la variante
      "bloc conteneur" (enfant direct du <td> ou du .ui-select-
      container). PAS le <span.ui-select-placeholder> interne au
      bouton toggle (qui est le libellé "Trésorerie..." et doit
      rester inline centré par le flex du .btn.ui-select-toggle). */
.td-t tbody td.tc-tr > .ui-select-placeholder,
.td-t tbody td .ui-select-container > .ui-select-placeholder {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 30px !important;
    max-height: 30px !important;
    line-height: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border: 0 !important;
}

/* 2-bis) Le <span.ui-select-placeholder> interne au bouton toggle
         (mode fermé, libellé "Trésorerie...") — on ANNULE toute
         hauteur/bloc qu'une règle plus haut aurait pu imposer,
         sinon il pousse son parent flex et le centrage casse. */
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle .ui-select-placeholder,
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle .ui-select-placeholder.text-muted {
    display: inline !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    vertical-align: middle !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 3) Input de recherche ui-select — dimensions IDENTIQUES au bouton
      match (30px) pour qu'aucun changement de hauteur ne se produise
      entre les états fermé / ouvert / re-fermé. On reste en flux
      normal (pas d'overlay absolu) pour éviter tout décalage visuel
      quand ui-select retire/remet l'élément.
      ⚠️ NE PAS forcer `display: block !important` : Angular utilise
      `.ng-hide { display: none !important }` pour masquer l'input
      quand le select est fermé. Si on force display:block avec une
      spécificité plus haute, l'input reste visible et on voit un
      "double select" (match + search empilés). On laisse donc
      `display` à la valeur par défaut — ui-select + ng-show gère
      la visibilité. */
.td-t tbody td.tc-tr .ui-select-container input.ui-select-search,
.td-t tbody td.tc-tr .ui-select-container input.ui-select-search.form-control,
.td-t tbody td .ui-select-container.ui-select-bootstrap input.ui-select-search.form-control {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    padding: 0 10px !important;
    margin: 0 !important;
    line-height: 28px !important;   /* 30 - 2px borders */
    font-size: 13px !important;
    border: 1px solid var(--ax-border-focus, #2563eb) !important;
    border-radius: 5px !important;
    background: #fff !important;
    box-sizing: border-box !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .10) !important;
    outline: none !important;
    vertical-align: middle !important;
}

/* Quand ui-select est fermé, .ui-select-search porte la classe
   .ng-hide → display:none. Quand il est ouvert, on veut display:block
   pleine largeur. On applique ça UNIQUEMENT sur `.ui-select-container.open`
   pour ne jamais contredire ng-hide en mode fermé. */
.td-t tbody td.tc-tr .ui-select-container.open input.ui-select-search,
.td-t tbody td .ui-select-container.open input.ui-select-search.form-control {
    display: block !important;
}

/* 4) Neutralise l'agrandissement Bootstrap dès l'ouverture, même
      avant que nos autres règles :not(absolute) s'appliquent. */
.td-t tbody td.tc-tr .ui-select-container.open,
.td-t tbody td.tc-tr .ui-select-container.select2-container-active,
.td-t tbody td.tc-tr .ui-select-container {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    line-height: 30px !important;
}

/* ================================================================
   FIX — Bordure/outline noir qui apparaît après avoir CLIQUÉ puis
   REFERMÉ le ui-select.
   ----------------------------------------------------------------
   Cause : après fermeture, ui-select remet le focus sur
   `.btn.ui-select-toggle` (via l'input offscreen .ui-select-focusser).
   Bootstrap applique alors sur ce <span.btn.btn-default> :
     - `outline: 5px auto -webkit-focus-ring-color` (Chrome/Edge)
     - `border-color: #8c8c8c` via .btn-default:focus
     - `box-shadow: inset 0 3px 5px rgba(0,0,0,.125)` via :active
   En plus ui-select ajoute la classe `.btn-default-focus` quand
   $select.focus est vrai → `background-color: #e6e6e6;
   border-color: #8c8c8c` (tons gris foncé qui donnent l'impression
   d'un liseré noir en haut).
   ----------------------------------------------------------------
   Fix : supprimer outline + uniformiser la bordure focus à notre
   couleur primaire (ou la masquer complètement si on préfère aucun
   retour visuel). Ici on garde un LÉGER liseré cohérent avec nos
   inputs .ti:focus (primary + shadow douce).
   ================================================================ */

.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle,
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle:focus,
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle:active,
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle:focus:active,
.td-t tbody td .ui-select-container .ui-select-match.btn-default-focus,
.td-t tbody td .ui-select-container .ui-select-match.btn-default-focus .btn.ui-select-toggle,
.td-t tbody td .ui-select-container.open .btn.ui-select-toggle,
.td-t tbody td .ui-select-container.select2-container-active .btn.ui-select-toggle {
    outline: 0 !important;
    outline-offset: 0 !important;
    background-color: #fff !important;
    background-image: none !important;
    border-color: var(--ax-border-input) !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
    color: var(--ax-text) !important;
}

/* État focus "propre" (liseré primaire discret, comme .ti:focus) */
.td-t tbody td .ui-select-container .ui-select-match .btn.ui-select-toggle:focus,
.td-t tbody td .ui-select-container.open .ui-select-match .btn.ui-select-toggle,
.td-t tbody td .ui-select-container .ui-select-match.btn-default-focus .btn.ui-select-toggle {
    border-color: var(--ax-border-focus, #2563eb) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .10) !important;
}

/* L'input offscreen .ui-select-focusser reçoit aussi le focus après
   fermeture — on s'assure qu'il reste 100% invisible (il a déjà la
   classe .ui-select-offscreen de ui-select, mais certaines règles
   projet .form-control peuvent le rendre visible). */
.td-t tbody td .ui-select-container input.ui-select-focusser,
.td-t tbody td .ui-select-container input.ui-select-focusser.form-control {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    z-index: -1 !important;
}
