:root {
    /* Neutrals — fond tres clair, cartes blanches, bordures fines (esprit SaaS) */
    --bg: #F7F9FC;
    --card: #ffffff;
    --card-alt: #EEF2F8;
    --border: #E3EAF2;
    --text: #233B57;
    --text-muted: #718096;
    --heading: #173B67;

    /* Marque — bleu SaaS, identite MSIT GES */
    --teal: #1683F7;
    --teal-dark: #0F63C4;
    --teal-soft: #EAF3FE;
    --emerald: #1d6f5c;

    /* Semantique — dissociee de la couleur de marque */
    --success: #2e8b57;
    --success-soft: #e3f3ea;
    --danger: #c0483d;
    --danger-soft: #fbeae8;
    --warning: #b8811f;
    --warning-soft: #faf0da;

    /* Sidebar — claire et aeree, pas de panneau sombre lourd */
    --navy: #FFFFFF;
    --navy-light: #F4F7FC;
    --navy-text: #233B57;
    --navy-text-muted: #8A97AC;
    --navy-border: #E3EAF2;

    --chart-bar: var(--teal);
    --chart-bar-alt: #e6e8ed;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(20,22,28,.04);
    --shadow: 0 1px 2px rgba(20,22,28,.04), 0 10px 26px -14px rgba(20,22,28,.16);
    --shadow-lg: 0 20px 45px -18px rgba(20,22,28,.35);

    --font-display: 'Inter', 'Segoe UI', Arial, sans-serif;
    --font-body: 'Manrope', 'Segoe UI', Arial, sans-serif;
}

:root[data-theme="dark"] {
    --bg: #14161b;
    --card: #1c1f26;
    --card-alt: #242830;
    --border: #2e333c;
    --text: #c7ccd3;
    --text-muted: #8a919c;
    --heading: #f1f1ee;

    --teal: #4fa2ff;
    --teal-dark: #7fbcff;
    --teal-soft: #1c2c40;
    --emerald: #4fbfa2;

    --success: #5fbe86;
    --success-soft: #1c3226;
    --danger: #e38a7e;
    --danger-soft: #3a2321;
    --warning: #e0b45c;
    --warning-soft: #3a2e17;

    --navy: #1c1f26;
    --navy-light: #242830;
    --navy-text: #e7eaef;
    --navy-text-muted: #8a919c;
    --navy-border: #2e333c;

    --chart-bar: var(--teal);
    --chart-bar-alt: #262b33;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 12px 30px -14px rgba(0,0,0,.6);
    --shadow-lg: 0 24px 55px -18px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    overflow-x: hidden;
}

h1, h2, h3 { text-wrap: balance; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* ---- Actions de la barre superieure (compte, support, theme, langue) ---- */
.topbar-actions { display: flex; align-items: center; gap: 22px; font-size: 12.5px; }
.util-item {
    display: flex; align-items: center; gap: 6px; color: var(--text-muted);
    background: none; border: none; padding: 0; font: inherit; cursor: pointer;
}
.util-item svg { width: 15px; height: 15px; opacity: .85; }
.util-item:hover { color: var(--teal); }
.topbar-actions .util-theme-toggle { width: auto; height: auto; border: none; background: none; border-radius: 0; }
.topbar-actions .util-theme-toggle:hover { color: var(--teal); border-color: transparent; }
.util-lang { position: relative; }
.util-lang-menu {
    position: absolute; top: calc(100% + 10px); right: 0; min-width: 140px; z-index: 50;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); padding: 6px;
}
.util-lang-option {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text);
    background: none; border: none; font-family: inherit; text-align: left; cursor: pointer;
}
.util-lang-option:hover { background: var(--card-alt); }
.util-lang-option.active { color: var(--teal); font-weight: 700; }
[dir="rtl"] .util-lang-option { text-align: right; }

/* ---- Indicateur de chargement de page (navigation) ---- */
#page-loading-overlay {
    position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center;
    background: rgba(255,255,255,.72);
}
#page-loading-overlay.active { display: flex; }
#page-loading-overlay img { width: 84px; height: 84px; }

/* ---- Shell general (espace connecte) ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    background: var(--navy);
    color: var(--navy-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--navy-border);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px; overflow: hidden; white-space: nowrap;
    padding: 22px 15px 4px; cursor: pointer;
}
.sidebar-logo-badge {
    width: 32px; height: 32px; border-radius: 9px; background: #fff; color: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
    font-family: var(--font-display); font-weight: 800; font-size: 14px;
}
.sidebar-logo-badge .nav-icon { width: 17px; height: 17px; opacity: 1; }
.sidebar-logo-badge img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand-text { font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -.01em; color: var(--heading); }
.sidebar-company { font-size: 12.5px; color: var(--navy-text-muted); padding: 0 22px 18px; border-bottom: 1px solid var(--navy-border); margin-bottom: 12px; }
.sidebar-nav { flex: 1; padding: 4px 14px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 13px; color: var(--navy-text-muted);
    border-radius: var(--radius); cursor: pointer; list-style: none; font-size: 13.75px; font-weight: 600;
    transition: background-color .12s, color .12s;
}
.nav-item::-webkit-details-marker { display: none; }
.nav-item:hover { background: var(--navy-light); color: var(--navy-text); }
.nav-item.active { background: var(--teal-soft); color: var(--teal); font-weight: 700; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.nav-item.active .nav-icon { opacity: 1; color: var(--teal); }
.nav-group-summary { justify-content: flex-start; }
.nav-group-summary span { flex: 1; }
.nav-group-summary .nav-icon:last-child { width: 13px; height: 13px; transition: transform .15s ease; opacity: .6; }
.nav-group[open] > .nav-group-summary .nav-icon:last-child { transform: rotate(180deg); }
.nav-subitems { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }
.nav-subitem { padding-left: 42px; font-size: 13px; font-weight: 500; }

.sidebar-backdrop { display: none; }

.hamburger-btn {
    display: none; align-items: center; justify-content: center; width: 38px; height: 38px;
    border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card);
    color: var(--text-muted); cursor: pointer; flex-shrink: 0; margin-right: 6px;
}
.hamburger-btn:hover { color: var(--teal); border-color: var(--teal); }

/* Sidebar reduite (60px) qui s'ouvre au survol (240px) — desktop/tablette
   uniquement ; en dessous de 961px la sidebar reste le tiroir plein-texte
   deja gere par la media query mobile plus bas (comportement inchange). */
@media (min-width: 961px) {
    .sidebar { width: 60px; overflow: hidden; transition: width .22s ease; }
    .sidebar.sidebar-expanded { width: 240px; box-shadow: var(--shadow-lg); }

    .sidebar-brand-text, .sidebar-company, .nav-item span {
        opacity: 0; transition: opacity .12s ease; white-space: nowrap;
    }
    .sidebar.sidebar-expanded .sidebar-brand-text,
    .sidebar.sidebar-expanded .sidebar-company,
    .sidebar.sidebar-expanded .nav-item span {
        opacity: 1;
    }

    .sidebar:not(.sidebar-expanded) .nav-group-summary .nav-icon:last-child { opacity: 0; }
    .sidebar:not(.sidebar-expanded) .nav-subitems { display: none; }
    .sidebar:not(.sidebar-expanded) .nav-item { justify-content: flex-start; }
}

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; justify-content: space-between; align-items: center; padding: 16px 32px;
    background: var(--card); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40; min-height: 68px;
}
.topbar-left { display: flex; align-items: center; }
.topbar h1 { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin: 0; color: var(--heading); letter-spacing: -.01em; }
.topbar-user { color: var(--text-muted); font-size: 13px; }
.content-body { padding: 30px 32px; flex: 1; }

.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--radius-pill); border: 1px solid var(--border);
    background: var(--card-alt); color: var(--text-muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--teal); border-color: var(--teal); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle svg.icon-sun { display: none; }
.theme-toggle svg.icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle svg.icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle svg.icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle svg.icon-sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle svg.icon-moon { display: none; }
}

/* ---- Composants ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow-sm); overflow-x: auto; }
.card h2 { margin-top: 0; font-size: 15.5px; font-weight: 700; color: var(--heading); }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid > * { min-width: 0; }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.stat-tile .value { font-family: var(--font-display); font-size: 27px; font-weight: 600; color: var(--heading); }
.stat-tile .label { color: var(--text-muted); font-size: 12.5px; margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.stat-tile .label .nav-icon { width: 14px; height: 14px; flex-shrink: 0; }

table.table { width: 100%; border-collapse: collapse; }
table.table th, table.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.table th { color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
table.table tbody tr:hover { background: var(--card-alt); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
    font-size: 14px; font-weight: 700; font-family: inherit; min-height: 44px;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease, transform .08s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-primary:disabled { background: var(--card-alt); color: var(--text-muted); cursor: not-allowed; }
.btn-secondary { background: var(--card); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--card-alt); border-color: var(--text-muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; min-height: 34px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 7px; font-weight: 700; font-size: 12.5px; color: var(--heading); }
.form-control, select.form-control, textarea.form-control {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14.5px; font-family: inherit; background: var(--card); color: var(--text); min-height: 44px;
}
textarea.form-control { min-height: 0; }
.form-control:focus, select.form-control:focus, textarea.form-control:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }

/* Selecteur de produit avec recherche (devis, factures, BL, BC, achats...) :
   ameliore un <select class="product-select"> existant sans toucher au reste
   du formulaire (voir includes/layout.php). Le select natif reste dans le
   DOM (masque visuellement mais toujours soumis/validable) pour ne rien
   casser du calcul de prix deja en place sur chaque page. */
.product-picker { position: relative; }
.product-select-native {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.product-search-results {
    position: fixed; z-index: 1000; max-height: 240px; overflow-y: auto;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.product-search-item { padding: 9px 12px; font-size: 13.5px; cursor: pointer; }
.product-search-item:hover, .product-search-item.is-active { background: var(--card-alt); }
.product-search-empty { padding: 9px 12px 4px; font-size: 13px; color: var(--text-muted); }
.product-search-create { display: block; padding: 9px 12px; font-size: 13px; font-weight: 700; color: var(--teal); cursor: pointer; text-decoration: none; }
.product-search-create:hover { background: var(--teal-soft); }

.badge { display: inline-block; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; letter-spacing: .01em; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--card-alt); color: var(--text-muted); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }

.alert { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; font-weight: 600; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--teal-soft); color: var(--teal-dark); }

.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }

/* ---- Pages plein ecran (login, erreurs) ---- */
.fullscreen-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); background-image: radial-gradient(circle at 15% 15%, rgba(22,131,247,.10), transparent 45%); }
.auth-card { background: var(--card); border-radius: var(--radius-lg); padding: 38px; width: 360px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 0 0 4px; color: var(--heading); }
.auth-card p.subtitle { color: var(--text-muted); margin: 0 0 22px; font-size: 13px; }
.auth-card .btn { width: 100%; }

.fullscreen-message { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: var(--bg); }
.fullscreen-message h1 { font-family: var(--font-display); font-size: 52px; color: var(--heading); margin: 0; }

.success-check {
    width: 64px; height: 64px; border-radius: 50%; background: var(--success);
    display: flex; align-items: center; justify-content: center; margin: 0 auto; box-shadow: 0 10px 24px -8px rgba(46,139,87,.5);
}

/* ---- Point de vente (caisse) ---- */
.pos-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.view-switch { display: flex; gap: 4px; background: var(--card-alt); border-radius: var(--radius-sm); padding: 4px; max-width: 100%; overflow-x: auto; }
.view-btn { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 7px; font-size: 13px; font-weight: 700; color: var(--text-muted); white-space: nowrap; border: none; background: none; font-family: inherit; cursor: pointer; }
.view-btn .nav-icon { width: 15px; height: 15px; }
.view-btn.active { background: var(--card); color: var(--teal); box-shadow: var(--shadow-sm); }

.pos-search { flex: 1; min-width: 220px; position: relative; display: flex; align-items: center; }
.pos-search .nav-icon { position: absolute; left: 16px; width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.pos-search .form-control { padding-left: 46px; height: 48px; font-size: 15px; border-radius: var(--radius); }

.pos-catalog-row { display: flex; gap: 14px; align-items: flex-start; }
.pos-categories { flex: none; width: 180px; display: flex; flex-direction: column; gap: 2px; }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius); font-size: 13.5px; color: var(--text-muted); font-weight: 600; }
.cat-item .nav-icon { width: 16px; height: 16px; opacity: .7; }
.cat-item:hover { background: var(--card-alt); }
.cat-item.active { background: var(--teal-soft); color: var(--teal); }
.cat-item.active .nav-icon { opacity: 1; color: var(--teal); }

.pos-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.pos-layout > * { min-width: 0; }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-product {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0 0 10px; overflow: hidden;
    cursor: pointer; text-align: left; box-shadow: var(--shadow-sm); min-height: 148px; display: flex; flex-direction: column;
    transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.pos-product:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--shadow); }
.pos-product .pos-avatar { width: 100%; height: 62px; font-size: 24px; border-radius: 0; margin-bottom: 9px; }
.pos-product .name { font-weight: 700; font-size: 13px; color: var(--text); padding: 0 12px; line-height: 1.3; }
.pos-product .price { color: var(--teal); font-weight: 800; margin-top: 4px; font-size: 14px; padding: 0 12px; }
.pos-product-stock { margin-top: auto; padding: 6px 12px 0; font-size: 11px; color: var(--text-muted); }
.pos-avatar {
    width: 40px; height: 40px; border-radius: var(--radius-sm); color: #fff; font-weight: 700; font-size: 16px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-display);
}
.pos-avatar-sm { width: 32px; height: 32px; font-size: 13px; border-radius: 7px; }

.pos-cart { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; position: sticky; top: 88px; box-shadow: var(--shadow); min-height: 572px; }
.pos-cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.pos-cart-header h2 { font-family: var(--font-display); font-size: 19px; font-weight: 700; }

/* Panier : en-tete, lignes, total et boutons lisibles, hauteur adaptee au contenu (pas plein ecran).
   Chaque section (en-tete, client, produits, totaux) est sa propre carte blanche
   separee par un espace, plutot qu'un seul bloc continu avec des lignes internes. */
#pos-cart {
    padding: 14px; display: flex; flex-direction: column; gap: 12px;
    background: var(--bg); border: none; box-shadow: none;
}
#pos-cart .pos-cart-header {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 14px 16px; margin-bottom: 0;
}
/* La zone panier ne s'etire plus pour occuper toute la hauteur disponible :
   elle ne prend que la place necessaire a son contenu, pas d'espace vide qui
   grandirait/retrecirait selon le nombre d'articles. */
#pos-cart .pos-cart-body { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
#pos-cart .pos-cart-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px 10px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
#pos-cart .pos-client-row {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 12px 16px; margin: 0;
}
#pos-cart .pos-cart-items-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 4px 16px; overflow: hidden;
}
#pos-cart .pos-cart-items-card .pos-cart-line:last-child { border-bottom: none; }
#pos-cart .pos-cart-header h2 { font-size: 19px; }
#pos-cart .pos-cart-header .icon-btn { width: 38px; height: 38px; }
#pos-cart .pos-cart-header .icon-btn .nav-icon { width: 18px; height: 18px; }
#pos-cart .pos-cart-line { padding: 10px 0; font-size: 14px; gap: 10px; }
#pos-cart .pos-avatar-sm { width: 34px; height: 34px; font-size: 14px; border-radius: 8px; }
#pos-cart .pos-cart-empty .nav-icon { width: 38px; height: 38px; }
#pos-cart .pos-cart-empty p { font-size: 13.5px; }
#pos-cart .pos-summary-line { font-size: 13px; padding: 6px 0; }
#pos-cart .pos-cart-totals-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 14px 16px;
}
#pos-cart .pos-total { font-size: 22px; margin: 0 0 14px; }
#pos-cart .btn { min-height: 46px; font-size: 14.5px; }

/* Vente rapide : scan code-barres / reference */
.pos-quick-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-sm); }
.pos-quick-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 20px; margin: 0 0 6px; color: var(--heading); }
.pos-quick-title .nav-icon { width: 20px; height: 20px; color: var(--teal); }
.pos-quick-form { margin-top: 22px; max-width: 480px; }
.pos-quick-row { position: relative; display: flex; align-items: center; }
.pos-quick-row .nav-icon { position: absolute; left: 16px; width: 18px; height: 18px; color: var(--text-muted); }
.pos-quick-row .form-control { padding-left: 46px; height: 52px; font-size: 16px; }
.pos-quick-row-secondary { display: flex; align-items: flex-end; gap: 14px; margin-top: 16px; }
.pos-quick-row-secondary .btn { flex: 1; }

.pos-quick-tabs { display: flex; gap: 4px; background: var(--card-alt); border-radius: var(--radius-sm); padding: 4px; width: fit-content; margin-top: 6px; }
.pos-quick-tab { padding: 9px 16px; border-radius: 7px; font-size: 13px; font-weight: 700; color: var(--text-muted); background: none; border: none; cursor: pointer; }
.pos-quick-tab.active { background: var(--card); color: var(--teal); box-shadow: var(--shadow-sm); }
.pos-quick-tab:not(.active):hover { color: var(--text); }
#quick-tab-scan, #quick-tab-amount { margin-top: 20px; }

.pos-quick-dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    min-height: 160px; border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 20px;
    cursor: pointer; background: var(--card-alt); transition: border-color .12s, background .12s;
}
.pos-quick-dropzone:hover, .pos-quick-dropzone.is-dragover { border-color: var(--teal); background: var(--teal-soft); }
.pos-quick-dropzone-icon {
    width: 44px; height: 44px; border-radius: 50%; background: var(--card); display: flex; align-items: center;
    justify-content: center; margin-bottom: 10px; box-shadow: var(--shadow-sm);
}
.pos-quick-dropzone-icon .nav-icon { width: 18px; height: 18px; color: var(--text-muted); }
.pos-quick-dropzone p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.pos-quick-dropzone img { max-width: 100%; max-height: 150px; border-radius: var(--radius-sm); object-fit: contain; }
.icon-btn {
    width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card);
    color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: var(--shadow-sm); transition: color .15s, border-color .15s, background .15s, transform .1s;
}
.icon-btn:hover { color: var(--teal); border-color: var(--teal); background: var(--teal-soft); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .nav-icon { width: 18px; height: 18px; stroke-width: 1.6; }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn:disabled:hover { transform: none; }
.icon-btn { position: relative; }
.icon-btn.is-active { color: var(--teal); border-color: var(--teal); background: var(--teal-soft); }
.icon-btn .dot { position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); border: 2px solid var(--card); }
.icon-btn-danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* Ligne client du panier : avatar + nom + bouton supprimer, en carte pleine largeur */
.pos-client-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pos-avatar-neutral { background: var(--card-alt); color: var(--text-muted); }
.pos-client-row .name { flex: 1; font-weight: 700; color: var(--heading); font-size: 14px; }
.pos-cart-empty { text-align: center; padding: 44px 10px; color: var(--text-muted); }
.pos-cart-empty .nav-icon { width: 36px; height: 36px; margin-bottom: 10px; opacity: .35; }
.pos-cart-empty p { margin: 4px 0; }
.pos-cart-line { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.qty-stepper { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.qty-btn {
    width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); background: var(--card-alt);
    color: var(--text); font-weight: 700; font-size: 14px; line-height: 1; cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { border-color: var(--teal); color: var(--teal); }
.qty-input-text {
    width: 40px; text-align: center; padding: 3px 2px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; font-family: inherit; background: var(--card); color: var(--text);
}
.pos-summary-line { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 13px; color: var(--text-muted); border-bottom: 1px dashed var(--border); }
.pos-summary-line strong { color: var(--heading); font-weight: 600; }
.pos-summary-line button {
    color: var(--danger); font-size: 13px; line-height: 1; background: var(--danger-soft); border: 1px solid transparent;
    width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-family: inherit; flex-shrink: 0; transition: background-color .12s ease, color .12s ease;
}
.pos-summary-line button:hover { background: var(--danger); color: #fff; }
.pos-summary-line .remove-x { color: var(--danger); margin-left: 8px; }
.pos-total { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-display); font-size: 22px; font-weight: 600; margin: 14px 0; color: var(--heading); }

/* Remise : bascule DH / % */
.discount-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.discount-toggle button { flex: 1; padding: 10px; font-weight: 700; font-size: 13px; color: var(--text-muted); background: var(--card); }
.discount-toggle button.active { background: var(--teal); color: #fff; }

/* Modal client : recherche + liste */
.client-search { position: relative; margin-bottom: 12px; }
.client-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; }
.client-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); width: 100%; background: none; border-left: none; border-right: none; border-top: none; text-align: left; cursor: pointer; font-family: inherit; }
.client-row:hover { background: var(--card-alt); }
.client-row .initials {
    width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--card-alt); color: var(--heading);
    font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.client-row .name { flex: 1; font-weight: 600; font-size: 13.5px; color: var(--text); }
.client-row .balance { font-size: 13px; font-weight: 700; }
.client-row .balance.owes { color: var(--danger); }
.client-row .balance.clear { color: var(--success); }
.client-row.active { background: var(--teal-soft); }
.client-row.active .name { color: var(--teal); }

/* ---- Page Clients : liste + panneau de detail ---- */
.clients-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.clients-layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.clients-layout > * { min-width: 0; }

.clients-list-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.clients-balance-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 18px 0; }
.clients-balance-stats .stat-tile { padding: 14px; box-shadow: none; }
.clients-list-header {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 16px 18px; font-weight: 700; font-size: 14px; color: var(--heading); border-bottom: 1px solid var(--border);
}
.clients-export-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--teal); }
.clients-export-link:hover { text-decoration: underline; }
.clients-export-link .nav-icon { width: 14px; height: 14px; }
.clients-list { display: flex; flex-direction: column; max-height: 640px; overflow-y: auto; }
.clients-list .client-row { padding: 12px 18px; border-radius: 0; }
.clients-pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--border); }
.balance-badge {
    display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--radius-pill);
    background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 700; white-space: nowrap;
}

/* Modal filtrer/trier (Clients) */
.filter-section-label { font-weight: 700; font-size: 14px; color: var(--heading); margin-bottom: 10px; }
.filter-sub-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 8px; }
.filter-pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-pill {
    display: inline-flex; align-items: center; padding: 8px 14px; border-radius: var(--radius-pill);
    border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.filter-pill:hover { border-color: var(--teal); }
input:checked + .filter-pill { background: var(--teal); color: #fff; border-color: var(--teal); }
.filter-radio-row {
    display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--text);
    padding: 7px 0; cursor: pointer;
}
.filter-radio-row input { width: 16px; height: 16px; accent-color: var(--teal); cursor: pointer; }

.clients-detail-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 28px; min-height: 500px; }
.clients-detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.clients-detail-header h2 { font-family: var(--font-display); font-size: 22px; margin: 0 0 6px; color: var(--heading); }
.initials-lg { width: 60px; height: 60px; font-size: 22px; border-radius: var(--radius); }

.clients-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 24px; }

.clients-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.client-tab { padding: 11px 16px; font-size: 13.5px; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.client-tab:hover { color: var(--text); }
.client-tab.active { color: var(--teal); border-bottom-color: var(--teal); }

.clients-info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.clients-info-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 6px; }

/* Carnet de credit client (onglet Credit) : mouvements donne/recu */
.credit-movement-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.credit-movement-note { font-weight: 600; color: var(--heading); }
.credit-movement-amount { font-weight: 800; font-size: 15px; }
.credit-movement-amount.gave { color: var(--danger); }
.credit-movement-amount.received { color: var(--success); }
.clients-info-value { font-size: 14.5px; color: var(--heading); }

.clients-empty { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.clients-empty .nav-icon { width: 40px; height: 40px; opacity: .3; margin-bottom: 12px; }
.clients-empty p { margin: 4px 0; }

/* Modal d'encaissement */
.pos-modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(15,17,21,.6); z-index: 100;
    align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px);
}
.pos-modal-overlay.open { display: flex; }
.pos-modal { background: var(--card); border-radius: var(--radius-lg); padding: 24px; width: 380px; max-width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.pos-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.pos-modal-head h3 { font-family: var(--font-display); margin: 0; font-size: 19px; color: var(--heading); }
.pos-amount-display { text-align: center; background: var(--card-alt); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.payment-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.payment-method-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); color: var(--text-muted); font-size: 11px; font-weight: 600;
}
.payment-method-btn .nav-icon { width: 18px; height: 18px; }
.payment-method-btn.active { border-color: var(--teal); color: var(--teal); background: var(--teal-soft); }
.pos-amount-input {
    font-family: var(--font-display); font-size: 27px; font-weight: 600; color: var(--heading); text-align: center; background: var(--card-alt);
    border-radius: var(--radius-sm); padding: 13px; margin-top: 6px;
}
.checkout-client-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card);
    color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: left;
}
.checkout-client-btn:hover { border-color: var(--teal); }
.checkout-client-btn .nav-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.checkout-client-btn span:nth-child(2) { flex: 1; }
.checkout-client-clear {
    color: var(--danger); font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: var(--radius-sm);
}
.checkout-client-clear:hover { background: var(--danger-soft); }

/* Modal "Encaisser" : dimensionne pour tenir dans la hauteur de l'ecran sans
   defilement sur un affichage courant. */
#checkout-overlay .pos-modal { width: 400px; padding: 20px; }
#checkout-overlay .pos-modal-head { margin-bottom: 12px; }
#checkout-overlay .pos-modal-head h3 { font-size: 19px; }
#checkout-overlay .pos-amount-display { padding: 10px; margin-bottom: 10px; }
#checkout-overlay .form-group { margin-bottom: 10px; }
#checkout-overlay .form-group label { font-size: 12.5px; margin-bottom: 4px; display: inline-block; }
#checkout-overlay .checkout-client-btn { padding: 8px 12px; font-size: 13px; gap: 7px; }
#checkout-overlay .checkout-client-btn .nav-icon { width: 16px; height: 16px; }
#checkout-overlay .payment-methods { gap: 7px; }
#checkout-overlay .payment-method-btn { padding: 8px 6px; font-size: 12px; gap: 4px; }
#checkout-overlay .payment-method-btn .nav-icon { width: 18px; height: 18px; }
#checkout-overlay .pos-amount-input { font-size: 21px; padding: 9px; }
#checkout-overlay .pin-keypad-lg { max-width: none; gap: 6px; }
#checkout-overlay .pin-keypad-lg .pin-key { padding: 9px 0; font-size: 14.5px; }

/* Modal de confirmation de paiement */
.pos-modal-success { width: 460px; text-align: center; padding: 40px 36px; }
.success-check-lg {
    width: 88px; height: 88px; border-radius: 50%; background: var(--teal);
    display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
    box-shadow: 0 12px 28px -10px rgba(22,131,247,.5);
}
.pos-modal-success h3 { font-family: var(--font-display); font-size: 20px; margin: 0 0 4px; color: var(--heading); }
.pos-modal-success-amount { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--heading); margin: 4px 0 8px; }

/* ---- Page Ventes : dernieres transactions ---- */
.badge-outline { background: var(--card); border: 1px solid var(--border); color: var(--text); }

.ventes-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.ventes-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 22px; overflow-x: auto; }

.ventes-filters-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ventes-filter-select { width: auto; min-width: 170px; flex: 1; min-height: 42px; padding: 9px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }

.ventes-table-wrap { max-height: 640px; overflow-y: auto; overflow-x: auto; margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); }
.ventes-table { min-width: 760px; }
.ventes-table { border-collapse: separate; border-spacing: 0; }
.ventes-table thead th {
    position: sticky; top: 0; background: var(--card-alt); z-index: 1; text-transform: uppercase;
    font-size: 11.5px; letter-spacing: .06em; padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.ventes-table tbody td { padding: 14px 16px; vertical-align: middle; }
.ventes-table tbody tr.ventes-row { cursor: pointer; }
.ventes-table tbody tr.ventes-row:hover { background: var(--teal-soft); }
.ventes-amount { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; color: var(--heading); }
.ventes-amount .nav-icon { width: 15px; height: 15px; color: var(--text-muted); }
.ventes-date-day { font-weight: 600; font-size: 13.5px; color: var(--heading); }
.ventes-date-time { font-size: 12px; color: var(--text-muted); }
.ventes-ticket { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--teal); }
.ventes-ticket .nav-icon { width: 15px; height: 15px; }
.ventes-row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.ventes-pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.ventes-pagination .is-disabled { opacity: .4; pointer-events: none; }

.ventes-detail-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; max-height: 220px; overflow-y: auto; }
.ventes-detail-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card-alt); border-radius: var(--radius-sm); }
.ventes-detail-item-thumb { width: 36px; height: 36px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.ventes-detail-item-name { font-weight: 600; font-size: 13.5px; color: var(--heading); }
.ventes-detail-item-total { font-weight: 700; font-size: 13.5px; color: var(--heading); }

@media (max-width: 960px) {
    .ventes-filter-select { min-width: 140px; }
}

/* Filtre "Toute la journee" : popover avec plage horaire personnalisee */
.ventes-tod-filter { position: relative; flex: 1; min-width: 170px; }
.ventes-tod-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.ventes-tod-trigger .nav-icon { width: 13px; height: 13px; color: var(--text-muted); flex-shrink: 0; }
.ventes-tod-popover {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: 260px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 16px;
}
.ventes-tod-option {
    display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--text);
    padding: 7px 0; cursor: pointer;
}
.ventes-tod-option input { width: 16px; height: 16px; accent-color: var(--teal); cursor: pointer; }
.ventes-tod-range { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 10px 0 16px; }
.ventes-tod-range.is-disabled { opacity: .45; pointer-events: none; }
.ventes-tod-range label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.ventes-tod-time { display: flex; gap: 6px; }
.ventes-tod-time select { padding: 8px 6px; font-size: 13px; min-height: 0; text-align: center; }
.ventes-tod-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Filtres "liste simple" (Utilisateur, Mode de paiement, Afficher N) */
.ventes-list-popover { width: 240px; }
.ventes-filter-list { display: flex; flex-direction: column; max-height: 280px; overflow-y: auto; margin-bottom: 12px; }
.ventes-filter-list-item {
    display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--text);
    padding: 8px 6px; border-radius: var(--radius-sm); cursor: pointer;
}
.ventes-filter-list-item:hover { background: var(--card-alt); }
.ventes-filter-list-item input { accent-color: var(--teal); cursor: pointer; }
.ventes-filter-list-item.is-disabled { color: var(--text-muted); cursor: not-allowed; }
.ventes-filter-list-item.is-disabled input { cursor: not-allowed; }

/* Filtre periode : liste de presets + deux calendriers */
.ventes-period-popover {
    width: 620px; display: grid; grid-template-columns: 160px 1fr; gap: 0; padding: 0;
}
.ventes-period-presets { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-right: 1px solid var(--border); }
.ventes-period-preset {
    text-align: left; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
    color: var(--text-muted); background: none; border: none; cursor: pointer;
}
.ventes-period-preset:hover { background: var(--card-alt); }
.ventes-period-preset.active { background: var(--teal-soft); color: var(--teal); }
.ventes-period-calendars { display: flex; gap: 18px; padding: 16px; }
.ventes-period-cal-col { flex: 1; min-width: 0; }
.ventes-period-cal-col label { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 6px; }
.ventes-period-date-display {
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px;
    font-weight: 600; color: var(--heading); margin-bottom: 10px; background: var(--card-alt);
}
.ventes-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12.5px; font-weight: 700; color: var(--heading); }
.ventes-cal-nav { width: 22px; height: 22px; border: none; background: none; color: var(--text-muted); cursor: pointer; border-radius: 5px; font-size: 14px; }
.ventes-cal-nav:hover { background: var(--card-alt); color: var(--teal); }
.ventes-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ventes-cal-weekdays { margin-bottom: 2px; }
.ventes-cal-weekdays span { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.ventes-cal-day {
    aspect-ratio: 1; border: none; background: none; border-radius: 6px; font-size: 12px; font-weight: 600;
    color: var(--text); cursor: pointer;
}
.ventes-cal-day:hover { background: var(--card-alt); }
.ventes-cal-day.in-range { background: var(--teal-soft); border-radius: 0; }
.ventes-cal-day.range-start { background: var(--teal); color: #fff; border-radius: 6px 0 0 6px; }
.ventes-cal-day.range-end { background: var(--teal); color: #fff; border-radius: 0 6px 6px 0; }
.ventes-cal-day.range-start.range-end { border-radius: 6px; }

@media (max-width: 700px) {
    .ventes-period-popover { width: 92vw; grid-template-columns: 1fr; }
    .ventes-period-presets { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); }
    .ventes-period-calendars { flex-direction: column; }
}

/* ---- Tableau de bord ---- */
.period-switch { display: flex; flex-wrap: wrap; gap: 4px; background: var(--card-alt); border-radius: var(--radius-pill); padding: 4px; }
.period-btn { padding: 7px 14px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--text-muted); white-space: nowrap; }
.period-btn:hover { color: var(--text); }
.period-btn.active { background: var(--teal); color: #fff; }
.chart-wrap { overflow-x: auto; }
.rank-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.rank-row:last-child { border-bottom: none; }
.rank-row span::before { content: '●'; color: var(--teal); font-size: 8px; margin-right: 8px; }
.dashboard-detail-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--teal); }
.dashboard-detail-link:hover { text-decoration: underline; }
.dashboard-detail-link .nav-icon { width: 14px; height: 14px; }

/* ---- Code PIN (changement rapide de caissier) ---- */
.pin-boxes { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.pin-box {
    width: 46px; height: 54px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 22px; color: var(--heading);
    background: var(--card); font-weight: 600; text-align: center; padding: 0; caret-color: var(--teal);
    transition: border-color .15s, box-shadow .15s;
}
.pin-box:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,131,247,.16); }
.pin-error { color: var(--danger); font-size: 13px; margin: 0 0 6px; }
.pin-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-key {
    padding: 14px 0; font-size: 16px; font-weight: 700; font-family: inherit; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--card); color: var(--text); cursor: pointer;
}
.pin-key:hover { background: var(--card-alt); }
#pin-backspace, #amount-backspace { color: var(--danger); }

.pin-keypad-lg { gap: 14px; max-width: 340px; }
.pin-keypad-lg .pin-key { padding: 24px 0; font-size: 22px; border-radius: var(--radius); }

/* ---- Responsive : tablette et mobile ---- */
.pos-cart-toggle { display: none; }

@media (max-width: 1180px) {
    .pos-layout { grid-template-columns: 1fr 340px; gap: 18px; }
    .pos-cart { padding: 18px; }
}

@media (max-width: 960px) {
    .hamburger-btn { display: flex; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 110; transform: translateX(-100%); width: 240px;
        transition: transform .2s ease; box-shadow: var(--shadow-lg);
    }
    .sidebar-brand-text, .sidebar-company, .nav-item span { opacity: 1; }
    .app-shell.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
        display: none; position: fixed; inset: 0; background: rgba(15,17,21,.45); z-index: 105;
    }
    .app-shell.sidebar-open .sidebar-backdrop { display: block; }
    .topbar { padding: 14px 18px; }
    .topbar h1 { font-size: 20px; }
    .content-body { padding: 20px 18px; }
    .topbar-actions .util-item span { display: none; }
    .topbar-actions { gap: 14px; }

    .pos-layout { grid-template-columns: 1fr; }
    .pos-catalog-row { flex-direction: column; }
    .clients-layout { grid-template-columns: 1fr; }
    .clients-list-panel, .clients-detail-panel { min-width: 0; overflow-x: auto; }
    .clients-info-grid { grid-template-columns: 1fr; }
    .clients-toolbar { flex-wrap: wrap; }
    .clients-toolbar .pos-search { flex-basis: 100%; order: 2; }
    .clients-toolbar .btn { order: 1; width: 100%; }
    .pos-categories { width: 100%; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
    .cat-item { white-space: nowrap; }
    .pos-products { grid-template-columns: repeat(2, 1fr); }

    .pos-cart, #pos-cart {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 90; min-height: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 78vh; overflow-y: auto;
        transform: translateY(calc(100% - 64px)); transition: transform .25s ease;
    }
    .pos-cart.open, #pos-cart.open { transform: translateY(0); }
    .pos-cart-toggle {
        display: flex; align-items: center; justify-content: space-between; gap: 10px;
        cursor: pointer; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border);
    }
    .pos-cart-toggle .chevron-up { transition: transform .2s ease; }
    .pos-cart.open .pos-cart-toggle .chevron-up { transform: rotate(180deg); }

    .clients-stats { grid-template-columns: 1fr !important; }
    .facture-stats-row { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 600px) {
    .pos-toolbar { gap: 10px; }
    .pos-search { order: 3; flex-basis: 100%; }
    .pos-products { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .pos-product { min-height: 138px; }
    .pos-product .pos-avatar { height: 58px; }
    .auth-card { width: 100%; padding: 28px 22px; }
}

/* ---- Page Configuration (parametres.php) ---- */
.settings-layout { display: flex; align-items: flex-start; gap: 24px; }
.settings-layout > * { min-width: 0; }
.settings-nav {
    flex: none; width: 235px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 14px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 3px;
}
.settings-nav-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--heading); padding: 8px 10px 12px; }
.settings-nav-item {
    display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 12px; border-radius: var(--radius);
    font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.25;
}
.settings-nav-item .nav-icon { width: 17px; height: 17px; color: var(--text-muted); flex-shrink: 0; }
.settings-nav-item:hover { background: var(--card-alt); }
.settings-nav-item.active { background: var(--teal-soft); color: var(--teal-dark); }
.settings-nav-item.active .nav-icon { color: var(--teal); }
.settings-nav-item span { flex: 1; }
.settings-nav-soon {
    margin-left: auto; flex-shrink: 0; font-size: 10px; font-weight: 700; color: var(--text-muted);
    background: var(--card-alt); border-radius: var(--radius-pill); padding: 2px 7px;
}
.settings-content { flex: 1; min-width: 0; }
.settings-time-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.settings-time-row h3 { flex: none; }
.settings-time-row select.settings-field { flex: 1; min-width: 260px; }
.settings-field:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.settings-placeholder { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.settings-placeholder .nav-icon { width: 40px; height: 40px; opacity: .35; margin-bottom: 14px; }
.settings-placeholder h3 { color: var(--heading); margin: 0 0 6px; }
.settings-placeholder p { max-width: 420px; margin: 0 auto; }

.settings-toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.settings-toggle-row:last-of-type { border-bottom: none; }
.settings-toggle-row p { margin: 4px 0 0; max-width: 640px; }
.settings-toggle-label { font-weight: 700; color: var(--heading); font-size: 14px; }

.settings-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.settings-switch input { opacity: 0; width: 0; height: 0; }
.settings-switch span { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background .15s; cursor: pointer; }
.settings-switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.settings-switch input:checked + span { background: var(--teal); }
.settings-switch input:checked + span::before { transform: translateX(18px); }

.settings-radio { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text); margin-right: 18px; cursor: pointer; }
.settings-radio input { accent-color: var(--teal); width: 16px; height: 16px; }

.settings-price-display { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; align-items: start; }

.settings-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-top: 16px; }
.settings-tab { display: flex; align-items: center; gap: 7px; padding: 10px 2px 12px; font-size: 13.5px; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.settings-tab .nav-icon { width: 16px; height: 16px; }
.settings-tab.active { color: var(--teal); border-color: var(--teal); }
.settings-tab:hover { color: var(--teal-dark); }

.settings-device-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.settings-device-row:last-child { border-bottom: none; }
.settings-device-icon { width: 38px; height: 38px; border-radius: var(--radius); background: var(--card-alt); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-muted); }
.settings-upsell { background: var(--card-alt); border-style: dashed; }

@media (max-width: 700px) {
    .settings-price-display { grid-template-columns: 1fr; gap: 16px; }
    .settings-toggle-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .settings-tabs { overflow-x: auto; }
    .settings-tab { white-space: nowrap; }
}

@media (max-width: 1180px) {
    .settings-nav { width: 200px; }
}

@media (max-width: 960px) {
    .settings-layout { flex-direction: column; }
    .settings-nav { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px; gap: 6px; }
    .settings-content { width: 100%; min-width: 0; }
    .settings-nav-title { display: none; }
    .settings-nav-item { flex: none; }
    .settings-nav-item span { overflow: visible; }
    .settings-time-row { flex-direction: column; align-items: stretch; gap: 10px; }
}

/* ---- Page Catalogue (Produits) : barre d'outils, recherche, filtres, tableau enrichi ---- */
.catalog-toolbar { display: flex; gap: 24px; flex-wrap: wrap; margin: 2px 0 20px; }
.catalog-toolbar-btn { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; padding: 0; font-size: 13.5px; font-weight: 600; color: var(--heading); cursor: pointer; text-decoration: none; font-family: inherit; }
.catalog-toolbar-btn .nav-icon { width: 16px; height: 16px; color: var(--teal); }
.catalog-toolbar-btn:hover:not(:disabled):not(.disabled) { color: var(--teal-dark); }
.catalog-toolbar-btn:disabled, .catalog-toolbar-btn.disabled { opacity: .45; cursor: not-allowed; }

.catalog-filters { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.catalog-filters select.form-control { width: auto; min-width: 160px; font-weight: 600; font-size: 13px; cursor: pointer; }

.catalog-row { cursor: pointer; }
.catalog-cell-main { font-weight: 700; color: var(--heading); }
.catalog-cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.catalog-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 18px; margin-top: 16px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.catalog-pagination select.form-control { width: auto; min-width: 66px; padding: 5px 8px; font-size: 13px; }
.catalog-pg-nav { display: flex; gap: 6px; }
.catalog-pg-nav a, .catalog-pg-nav span { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text); }
.catalog-pg-nav a:hover { background: var(--card-alt); }
.catalog-pg-nav .disabled { opacity: .4; pointer-events: none; }

@media (max-width: 700px) {
    .catalog-pagination { justify-content: space-between; width: 100%; }
}

/* ---- Modale "Étiquettes de codes à barres" : selecteur double-liste ---- */
.labels-modal { width: 920px; max-width: 96vw; padding: 26px; }
.labels-picker { display: grid; grid-template-columns: 190px 1fr 40px 1fr; gap: 18px; margin-top: 16px; align-items: start; }
.labels-picker-filters { display: flex; flex-direction: column; gap: 2px; }
.labels-picker-filters-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 8px; }
.labels-picker-filters-subtitle { font-size: 12.5px; font-weight: 700; color: var(--heading); margin: 12px 0 4px; }
.labels-cat-btn { display: block; width: 100%; text-align: left; background: none; border: none; border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; color: var(--text); cursor: pointer; }
.labels-cat-btn:hover { background: var(--card-alt); }
.labels-cat-btn.active { background: var(--teal-soft); color: var(--teal-dark); font-weight: 700; }

.labels-picker-col { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.labels-picker-col-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.labels-picker-col-head > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--heading); }
.labels-picker-col-head .nav-icon { width: 18px; height: 18px; color: var(--text-muted); }
.labels-picker-col-head a { font-size: 12.5px; color: var(--teal); font-weight: 600; white-space: nowrap; }
.labels-picker-col .pos-search .form-control { height: 38px; font-size: 13px; padding-left: 40px; }
.labels-picker-col .pos-search .nav-icon { left: 12px; width: 15px; height: 15px; }

.labels-list { height: 320px; overflow-y: auto; border-top: 1px solid var(--border); }
.labels-list-item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.labels-list-item-name { flex: 1; font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.labels-toggle-btn { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--teal); font-size: 16px; line-height: 1; cursor: pointer; flex-shrink: 0; }
.labels-toggle-btn:hover { background: var(--teal-soft); }

.labels-picker-arrows { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 320px; margin-top: 78px; color: var(--text-muted); }
.labels-picker-arrows .nav-icon { width: 16px; height: 16px; }
.labels-arrow-right { transform: rotate(-90deg); }
.labels-arrow-left { transform: rotate(90deg); }

.labels-picker-footer { display: flex; justify-content: flex-end; margin-top: 18px; }

@media (max-width: 860px) {
    .labels-picker { grid-template-columns: 1fr; }
    .labels-picker-arrows { display: none; }
    .labels-picker-filters { flex-direction: row; flex-wrap: wrap; }
}

/* ---- Support RTL (arabe) : coquille commune (sidebar, en-tete, menus) ----
   Portee actuelle : structure partagee par toutes les pages. Le contenu
   propre a chaque page reste aligne a gauche (texte francais non traduit). */
[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--navy-border); }
[dir="rtl"] .nav-subitem { padding-left: 0; padding-right: 42px; }
[dir="rtl"] .hamburger-btn { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .util-lang-menu { right: auto; left: 0; }
[dir="rtl"] .nav-group-summary .nav-icon:last-child { transform: scaleX(-1); }
[dir="rtl"] .nav-group[open] > .nav-group-summary .nav-icon:last-child { transform: scaleX(-1) rotate(180deg); }

@media (max-width: 960px) {
    [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(100%); }
    [dir="rtl"] .app-shell.sidebar-open .sidebar { transform: translateX(0); }
}
