/* ── Base ───────────────────────────────────────────────────────────────── */
html { font-size: 0.9em; }

/* ── États cachés ───────────────────────────────────────────────────────── */
#modifView { display: none; }
.edit      { display: none; }
.deleteIt  { display: none; }
.paynow    { display: none; }

/* ── Utilitaires ────────────────────────────────────────────────────────── */
.flex           { display: flex; }
.align-item     { align-items: center; }
.justify-center { justify-content: center; }
.mycart         { justify-content: center; }
.cart_top       { display: flex; justify-content: space-between; }

/* ── Couleurs tableaux inventaire ───────────────────────────────────────── */
.inv-row.modified     { background: #fffbe6; }
.conflict-row td      { background: #fff3cd !important; }
.duplicate-row td     { background: #f8d7da !important; }
.merge-row td         { background: #d4edda !important; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
table {
    display: block;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
#salesImportPage .sale-left,
#salesImportPage .sale-right,
#panelManuelImport,
#panelCsvImport {
    overflow: hidden;
}
.tab-active {
    border-bottom: 2px solid #1565c0;
    color: #1565c0;
    font-weight: 600;
}
th {
    background: #f9fafb;
    text-align: left;
    padding: 3px;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    white-space: nowrap;
}
td {
    padding: 3px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
tr:hover td { background: #f9fafb; }

/* ── Headers fixes au scroll ─────────────────────────────────────────── */
thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f9fafb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ── Zebra striping ──────────────────────────────────────────────────── */
tbody tr:nth-child(even) td {
    background: #f9fafb;
}
tbody tr:hover td {
    background: #eff6ff;
}

/* ── Ombre scroll horizontal ─────────────────────────────────────────── */
table {
    background:
        linear-gradient(to right, white 30%, rgba(255,255,255,0)),
        linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%,
        radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,0.08), rgba(0,0,0,0)),
        radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.08), rgba(0,0,0,0)) 0 100%;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}

/* ── Smooth scroll ───────────────────────────────────────────────────── */
* { scroll-behavior: smooth; }

/* ── Inputs globaux ─────────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="week"],
input[type="month"],
select,
textarea {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 3px;
    font-size: 0.8rem;
    max-width: 100%;
    box-sizing: border-box;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
input[type="number"] {
    width: 60px;
}
input[type="checkbox"] { width: auto; }

/* ── Boutons submit ─────────────────────────────────────────────────────── */
input[type="submit"],
button[type="submit"] {
    background: #1d4ed8;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.875rem;
}
input[type="submit"]:hover,
button[type="submit"]:hover { background: #1e40af; }

/* ── Remarque scrollable ─────────────────────────────────────────────────── */
input.rmq, input[name^="rmq"] {
    width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Sidebar desktop ────────────────────────────────────────────────────── */
@media (min-width: 1024px) {
    #sidebar { transform: translateX(0) !important; }
    main     { margin-left: 224px; }
}

/* ── Container ──────────────────────────────────────────────────────────── */
.container { width: 100%; }

/* ── Layout vente (sale.php) ────────────────────────────────────────────── */
.sale-left,
.sale-right {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    overflow: hidden;
    min-width: 0; /* ← important pour grid */
}
.sale-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
@media (min-width: 1024px) {
    .sale-layout {
        display: grid;
        grid-template-columns: 1fr 2fr;
        align-items: start;
    }
    #sidebar { transform: translateX(0) !important; }
    main     { margin-left: 140px; }

}
