/* =============================
   CHECKGRID — SÉLECTEUR DÉPENSES
   ============================= */

#checkgrid-box {
    overflow-x: hidden;
}

/* Bouton + Ajouter aligné à droite */
#cg_add_form2 {
    margin-bottom: 10px;
    text-align: right;
}

#cg_add_btn2 {
    cursor: pointer;
}

/* Table de base */
#checkgrid-box .budget-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

/* EN-TÊTES */
#checkgrid-box .budget-table thead th {
    padding: 4px 6px;
    font-weight: 600;
    white-space: normal;
    overflow: visible;
}

/* CELLULES BODY */
#checkgrid-box .budget-table tbody td {
    padding: 2px 4px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Largeurs colonnes */
#checkgrid-box .budget-table th:nth-child(1),
#checkgrid-box .budget-table td:nth-child(1) {
    width: 55px;
    text-align: center;
}

#checkgrid-box .budget-table th:nth-child(2),
#checkgrid-box .budget-table td:nth-child(2) {
    width: auto;
}

#checkgrid-box .budget-table th:nth-child(3),
#checkgrid-box .budget-table td:nth-child(3) {
    width: 105px;
    text-align: right;
}

#checkgrid-box .budget-table th:nth-child(4),
#checkgrid-box .budget-table td:nth-child(4) {
    width: 35px;
    text-align: right;
}

/* CELLULE NOM */
.cg-label-cell {
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.cg-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
    margin-right: 4px;
}

/* Inputs texte + montant */
.cg-label,
.cg-amount {
    background: #0f0f17;
    border: 1px solid #4b5563;
    border-radius: 6px;
    padding: 3px 5px;
    color: #e5e7ff;
    font-size: 0.8rem;
    box-sizing: border-box;
    margin: 0;
    line-height: 1.1;
}

/* NOM : largeur max ajustée pour tout voir */
.cg-label {
    width: 100%;
    max-width: calc(100% - 10px); /* nom beaucoup plus visible */
}

.cg-label:focus,
.cg-amount:focus {
    border-color: #c084fc;
    box-shadow: 0 0 6px #c084fc66;
}

/* ====== MONTANT ====== */
.amount-cell {
    white-space: nowrap;
    text-align: right;
    position: relative;
    padding-left: 10px; /* serré mais propre */
    overflow: visible !important;
}

/* Signe − très proche du montant */
.amount-cell .amount-sign {
    position: absolute;
    left: 2px; /* collé au bord */
    top: 50%;
    transform: translateY(-50%);
    color: #f87171;
    text-shadow: 0 0 6px #ef4444aa;
}

/* Input montant (taille réduite vraiment) */
.amount-cell .cg-amount {
    width: 52px;
    text-align: right;
}

/* Checkbox */
.cg-check {
    width: 20px;
    height: 20px;
    accent-color: #c084fc;
    cursor: pointer;
}

/* Cellule croix */
.cg-delete-cell {
    text-align: right;
    white-space: nowrap;
    overflow: visible !important;
}

#checkgrid-box .cg-delete {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1;
}

#checkgrid-box .cg-delete:hover {
    color: #f87171;
}

/* Total */
#cg_total {
    color: #c084fc;
    font-weight: bold;
    text-shadow: 0 0 6px #c084fcaa;
}

/* =============================
   COULEURS VISUELLES 50/30/20
   ============================= */

.budget-row.cg-essential .cg-label,
.budget-row.cg-essential .cg-amount { color: #4ade80; }
.budget-row.cg-essential .cg-dot { background: #4ade80; }

.budget-row.cg-important .cg-label,
.budget-row.cg-important .cg-amount { color: #facc15; }
.budget-row.cg-important .cg-dot { background: #facc15; }

.budget-row.cg-pleasure .cg-label,
.budget-row.cg-pleasure .cg-amount { color: #d8b4fe; }
.budget-row.cg-pleasure .cg-dot { background: #d8b4fe; }

/* =============================
   ANALYSE + BOUTON SAVE
   ============================= */

#checkgrid-compare .cg-subtitle {
    color: #a78bfa;
    font-size: 0.85rem;
    margin: 4px 0 8px;
    text-shadow: 0 0 4px #7c3aed88;
}

.cg-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.cg-compare-table th,
.cg-compare-table td {
    padding: 5px 6px;
    border-bottom: 1px solid #4b556355;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cg-filter-btn {
    margin-left: 8px;
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
}

/* Bouton enregistrer */
.cg-save-form {
    margin-top: 8px;
    text-align: right;
}

.cg-save-btn {
    cursor: pointer;
}

/* 🔵 Supprimer les flèches dans les inputs number (Chrome, Edge, Opera) */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 🔵 Supprimer les flèches dans Firefox */
input[type=number] {
    -moz-appearance: textfield;
}
