* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg-base: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --bg-base-rgb: 15,23,42;     /* v47: rgb triplets for rgba(var(--bg-base-rgb),x) tints */
    --bg-card-rgb: 30,41,59;
    --border-color: #334155;
    --border-hover: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #10b981;               /* v42: overridden by navbar brand injection */
    --accent-dark: #059669;          /* v42: overridden by navbar brand injection */
    --accent-rgb: 16,185,129;        /* v42: overridden by navbar brand injection */
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #3b82f6;
    --purple: #7c3aed;
}
body { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; background: var(--bg-base); color: var(--text-primary); direction: rtl; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

/* ====== NAVBAR (responsive) ====== */
.navbar { background: var(--bg-card); border-bottom: 1px solid var(--border-color); padding: 0 16px; display: flex; align-items: center; justify-content: space-between; height: 56px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
.navbar-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--accent); min-width: 0; }
.navbar-brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; }
.navbar-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; font-size: 16px; }
.navbar-right { display: flex; align-items: center; gap: 10px; }
.navbar-nav { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.navbar-nav a, .navbar-nav button { background: none; border: none; color: var(--text-secondary); padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; transition: all 0.2s; white-space: nowrap; }
.navbar-nav a:hover, .navbar-nav button:hover { background: var(--border-color); color: var(--text-primary); }
.navbar-nav .active { background: var(--border-color); color: var(--accent); }
.nav-user { color: var(--text-secondary); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.nav-user-name { display: inline-block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Role badges hidden from UI - admin status should not be visible */

/* Mobile hamburger button */
.nav-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 24px; cursor: pointer; padding: 6px 10px; border-radius: 6px; }
.nav-toggle:hover { background: var(--border-color); }

/* ====== CONTAINER ====== */
.container { max-width: 1280px; margin: 0 auto; padding: 20px 16px; }

/* ====== CARDS ====== */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }

/* ====== STATS ====== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px; padding: 18px; text-align: center; transition: all 0.25s; cursor: pointer; }
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(var(--accent-rgb, 16,185,129),0.15); }
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }
.stat-card .stat-label { color: var(--text-secondary); font-size: 12px; margin-top: 6px; font-weight: 500; }

/* ====== TABLE (responsive) ====== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--bg-base); color: var(--text-secondary); padding: 10px 12px; text-align: right; font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid rgba(30,58,95,0.13); color: #e2e8f0; vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,0.03); }
tr:last-child td { border-bottom: none; }

/* ====== BUTTONS ====== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s; font-family: inherit; }
.btn-primary { background: var(--accent); color: white; font-weight: 600; }
.btn-primary:hover { background: var(--accent-dark); box-shadow: 0 4px 12px rgba(var(--accent-rgb, 16,185,129),0.3); }
.btn-secondary { background: var(--border-color); color: var(--text-primary); }
.btn-secondary:hover { background: var(--border-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #d97706; color: white; }
.btn-warning:hover { background: #b45309; }
.btn-info { background: #0284c7; color: white; }
.btn-info:hover { background: #0369a1; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: var(--border-color); color: var(--text-primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ====== FORMS ====== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; color: var(--text-secondary); font-size: 13px; margin-bottom: 5px; }
.form-control { width: 100%; padding: 10px 12px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-size: 14px; transition: border-color 0.2s; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 16,185,129),0.2); }
.form-control::placeholder { color: #475569; }
select.form-control option { background: var(--bg-card); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ====== BADGES ====== */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-green { background: rgba(var(--accent-rgb, 16,185,129),0.15); color: var(--accent); }
.badge-red { background: rgba(220,38,38,0.15); color: #f87171; }
.badge-blue { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-yellow { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-gray { background: rgba(100,116,139,0.15); color: var(--text-secondary); }
.badge-purple { background: rgba(124,58,237,0.15); color: #a78bfa; }

/* ====== TABS ====== */
.tabs { display: flex; gap: 4px; background: var(--bg-base); border-radius: 10px; padding: 4px; margin-bottom: 18px; flex-wrap: wrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-btn { padding: 9px 14px; border-radius: 7px; border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s; white-space: nowrap; }
.tab-btn.active { background: var(--bg-card); color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.3); font-weight: 600; }
.tab-btn:hover:not(.active) { color: var(--text-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ====== MODAL (mobile-friendly) ====== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 200; align-items: center; justify-content: center; padding: 12px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 22px; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; position: relative; -webkit-overflow-scrolling: touch; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; position: sticky; top: -22px; background: var(--bg-card); padding-top: 4px; padding-bottom: 12px; z-index: 2; }
.modal-title { font-size: 17px; font-weight: 600; color: var(--text-primary); }
.modal-close { background: none; border: none; color: var(--text-secondary); font-size: 22px; cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1; }
.modal-close:hover { background: var(--border-color); color: var(--text-primary); }

/* ====== SEARCH ====== */
.search-bar { display: flex; align-items: center; gap: 8px; }
.search-input { flex: 1; padding: 10px 12px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-size: 14px; font-family: inherit; }
.search-input:focus { outline: none; border-color: var(--accent); }

/* ====== PRODUCT IMAGES ====== */
.product-img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-color); }
.product-img-placeholder { width: 44px; height: 44px; background: var(--border-color); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #475569; font-size: 20px; }

/* ====== QUANTITY ====== */
.qty-badge { font-size: 15px; font-weight: 700; }
.qty-ok { color: var(--accent); }
.qty-low { color: var(--warning); }
.qty-zero { color: var(--danger); }

/* ====== ALERTS ====== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: rgba(var(--accent-rgb, 16,185,129),0.15); border: 1px solid var(--accent); color: #6ee7b7; }
.alert-error { background: rgba(220,38,38,0.15); border: 1px solid var(--danger); color: #fca5a5; }
.alert-info { background: rgba(59,130,246,0.15); border: 1px solid var(--info); color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,0.15); border: 1px solid var(--warning); color: #fcd34d; }

/* ====== EMPTY STATE ====== */
.empty-state { text-align: center; padding: 40px 20px; color: #475569; }
.empty-state .icon { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ====== PROJECT CARDS ====== */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.project-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px; padding: 20px; transition: all 0.25s; cursor: pointer; position: relative; overflow: hidden; }
.project-card::before { content: ''; position: absolute; top: 0; right: 0; width: 4px; height: 100%; background: var(--accent); border-radius: 0 14px 14px 0; opacity: 0; transition: opacity 0.2s; }
.project-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.project-card:hover::before { opacity: 1; }
.project-card-name { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.project-card-company { color: var(--text-secondary); font-size: 13px; margin-bottom: 4px; }
.project-card-city { color: var(--text-muted); font-size: 12px; }

/* ====== FILTERS ====== */
.filters-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ====== TOAST ====== */
#toast-container { position: fixed; bottom: 16px; left: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 10px; font-size: 13px; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,0.4); animation: slideIn 0.3s ease; max-width: 100%; pointer-events: auto; }
.toast-success { background: #065f46; color: #6ee7b7; border: 1px solid var(--accent); }
.toast-error { background: #7f1d1d; color: #fca5a5; border: 1px solid var(--danger); }
.toast-info { background: #1e3a5f; color: #93c5fd; border: 1px solid var(--info); }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(10px); } }

/* ====== PAGE HEADER ====== */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; justify-content: space-between; }
.page-header > div { min-width: 0; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.page-header .breadcrumb { color: var(--text-muted); font-size: 13px; }

/* ====== BUTTON GROUP ====== */
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ====== IMAGE PREVIEW ====== */
.img-preview { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-color); display: block; margin-top: 8px; }

/* ====== COLOR DOT ====== */
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* ====== TRANSACTION TYPES ====== */
.tx-in { color: var(--accent); font-weight: 600; }
.tx-out { color: #f87171; font-weight: 600; }

/* ============================================================
   WORKERS — new feature styles
   ============================================================ */
.autocomplete-wrap { position: relative; }
.autocomplete-list { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; max-height: 280px; overflow-y: auto; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,0.4); display: none; }
.autocomplete-list.show { display: block; }
.autocomplete-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid rgba(51,65,85,0.5); transition: background 0.15s; }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active { background: var(--border-color); }
.autocomplete-item .ai-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.autocomplete-item .ai-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.autocomplete-item .ai-new { color: var(--accent); font-size: 12px; }

.worker-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; transition: all 0.2s; cursor: pointer; }
.worker-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.worker-card-name { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.worker-card-meta { color: var(--text-muted); font-size: 12px; margin-bottom: 2px; }
.worker-card-actions { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

/* Loan cart (multi-item selection) */
.loan-cart { background: var(--bg-input); border: 1px dashed var(--border-color); border-radius: 10px; padding: 14px; margin-top: 10px; }
.loan-cart-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.loan-cart-item:last-child { margin-bottom: 0; }
.loan-cart-item .lci-name { flex: 1; min-width: 120px; font-weight: 600; color: var(--text-primary); font-size: 13px; }
.loan-cart-item .lci-meta { color: var(--text-muted); font-size: 11px; }
.loan-cart-item input[type="number"] { width: 70px; padding: 6px 8px; background: var(--bg-base); border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-primary); font-size: 13px; }
.loan-cart-item .lci-type { font-size: 10px; padding: 2px 8px; border-radius: 10px; }
.loan-cart-item .lci-type.tool { background: rgba(124,58,237,0.15); color: #a78bfa; }
.loan-cart-item .lci-type.product { background: rgba(59,130,246,0.15); color: #60a5fa; }
.loan-cart-item .lci-consumable { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: rgba(245,158,11,0.15); color: #fbbf24; cursor: pointer; user-select: none; }
.loan-cart-item .lci-consumable.active { background: rgba(245,158,11,0.35); color: #fef3c7; }
.loan-cart-item .lci-remove { background: var(--danger); color: white; border: none; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.loan-cart-empty { text-align: center; color: var(--text-muted); padding: 20px; font-size: 13px; }

.item-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; max-height: 360px; overflow-y: auto; padding: 4px; }
.item-pick-card { background: var(--bg-base); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px 12px; cursor: pointer; transition: all 0.15s; }
.item-pick-card:hover { border-color: var(--accent); background: var(--bg-card); }
.item-pick-card.disabled { opacity: 0.4; cursor: not-allowed; }
.item-pick-card .ipc-name { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.item-pick-card .ipc-meta { font-size: 11px; color: var(--text-muted); display: flex; justify-content: space-between; }

/* ============================================================
   RESPONSIVE — TABLETS & PHONES
   ============================================================ */
@media (max-width: 900px) {
    .container { padding: 16px 12px; }
    .page-header h1 { font-size: 20px; }
    .stat-card .stat-value { font-size: 26px; }
    .navbar { padding: 0 12px; }
    .navbar-brand span { max-width: 140px; font-size: 16px; }
    .nav-user-name { display: none; }
}

@media (max-width: 768px) {
    /* Mobile navbar — hamburger toggles a dropdown menu */
    .nav-toggle { display: inline-block; }
    .navbar-nav {
        position: absolute;
        top: 60px;
        right: 0;
        left: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        align-items: stretch;
        padding: 8px 12px;
        gap: 2px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease;
        z-index: 99;
    }
    .navbar-nav.open { max-height: 500px; overflow-y: auto; }
    .navbar-nav a, .navbar-nav button { padding: 12px 14px; text-align: right; font-size: 15px; }
    .nav-user { gap: 6px; }
    .nav-user .badge-admin, .nav-user .badge-user { display: none; }

    /* Stack form rows */
    .form-row, .form-row-3 { grid-template-columns: 1fr; }

    /* Stats grid: 2 per row on phone */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-card .stat-value { font-size: 22px; }
    .stat-card .stat-label { font-size: 11px; }

    /* Cards: tighter padding */
    .card { padding: 14px; }
    .modal { padding: 16px; border-radius: 12px; }

    /* Project grid: 1 col on small phones, 2 on larger phones */
    .project-grid { grid-template-columns: 1fr; }

    /* Tabs: smaller */
    .tabs { padding: 3px; gap: 2px; }
    .tab-btn { padding: 8px 12px; font-size: 12px; }

    /* Tables: keep horizontal scroll on phones, but make text readable */
    table { font-size: 12px; }
    th, td { padding: 8px 10px; }

    /* Buttons: bigger tap target */
    .btn { padding: 10px 14px; font-size: 13px; }
    .btn-sm { padding: 8px 12px; }

    /* Page header: stack */
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header .btn-group { justify-content: stretch; }
    .page-header .btn-group .btn { flex: 1; }

    /* Item picker: single column */
    .item-picker-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .container { padding: 12px 8px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .navbar-brand span { max-width: 100px; font-size: 15px; }
    .modal { padding: 14px; }
    .modal-title { font-size: 15px; }
    .loan-cart-item { gap: 6px; }
    .loan-cart-item .lci-name { font-size: 12px; min-width: 100px; }
    .loan-cart-item input[type="number"] { width: 60px; }
    /* Hide secondary columns in tables on tiny screens using data-hide attribute */
    table [data-hide="mobile"] { display: none; }
}

/* Touch-friendly tap targets on mobile */
@media (hover: none) and (pointer: coarse) {
    .btn, .tab-btn, .navbar-nav a { min-height: 40px; }
    .form-control { min-height: 42px; font-size: 15px; }
    .autocomplete-item { padding: 12px 14px; }
}

/* v41: live filter result counter chip (movements / inventory / entree / sortie) */
.filter-count {
    display: inline-flex; align-items: center; background: rgba(var(--accent-rgb, 16,185,129),0.15); color: var(--accent, #10b981);
    border: 1px solid rgba(var(--accent-rgb, 16,185,129),0.4); padding: 6px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
}

/* ============================================================
   v46 — PROFESSIONAL UI POLISH (additive only, nothing renamed)
   ============================================================ */

/* ============================================================
   v47 — FULL-PROGRAM THEME + PROFESSIONAL MODALS + BIG PICKER
   ============================================================ */

/* --- Buttons: text color adapts to bright brand colors --- */
.btn-primary { color: var(--on-accent, #fff); }

/* --- Color picker: BIG squares — preset swatches sized like the main picker (owner request v47.2) --- */
.v47-color-input { width: 96px; height: 48px; padding: 5px; border-radius: 10px; cursor: pointer; background: var(--bg-input, #0f172a); border: 1px solid var(--border-color, #334155); flex-shrink: 0; transition: border-color 0.15s, box-shadow 0.15s; }
.v47-color-input:hover { border-color: var(--accent, #10b981); }
.v47-color-input:focus { outline: none; border-color: var(--accent, #10b981); box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 16,185,129),0.18); }
.v47-color-hex { display: inline-flex; align-items: center; justify-content: center; min-width: 104px; height: 48px; padding: 0 16px; background: var(--bg-input, #0f172a); border: 1px solid var(--border-color, #334155); border-radius: 10px; font-family: monospace; font-size: 13px; color: var(--text-secondary, #94a3b8); letter-spacing: 1px; }
.color-swatches.v47-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px; max-width: 620px; margin-top: 14px; }
.color-swatch { width: 64px; height: 64px; border-radius: 14px; border: 3px solid rgba(255,255,255,0.16); cursor: pointer; transition: all 0.15s; padding: 0; box-shadow: inset 0 1px 2px rgba(255,255,255,0.28), 0 3px 8px rgba(0,0,0,0.4); }
.color-swatch:hover { transform: translateY(-3px) scale(1.06); border-color: rgba(255,255,255,0.45); box-shadow: inset 0 1px 2px rgba(255,255,255,0.3), 0 6px 16px rgba(0,0,0,0.5); }
.color-swatch.active { border-color: #f1f5f9; box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 16,185,129),0.6), 0 4px 14px rgba(0,0,0,0.5); transform: scale(1.06); }
.color-swatch.active::after { content: '✓'; display: flex; align-items: center; justify-content: center; height: 100%; color: #fff; font-size: 22px; font-weight: 800; text-shadow: 0 1px 4px rgba(0,0,0,0.6); }

/* --- Unified professional modals: accent header band + centered, consistent everywhere (v47) --- */
.modal { --modal-pad: 22px; padding: var(--modal-pad); border: 1px solid var(--border-color, #334155); border-radius: 18px; box-shadow: 0 24px 64px rgba(0,0,0,0.55), 0 4px 16px rgba(0,0,0,0.4); animation: wmsModalIn 0.22s ease both; background: var(--bg-card, #1e293b); }
@keyframes wmsModalIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header {
    background: linear-gradient(135deg, var(--accent, #10b981), var(--accent-dark, #059669));
    margin: calc(-1 * var(--modal-pad)) calc(-1 * var(--modal-pad)) 18px;
    padding: 14px 20px;
    border-radius: 17px 17px 0 0;
    position: sticky; top: calc(-1 * var(--modal-pad)); z-index: 3;
    box-shadow: 0 2px 12px rgba(var(--accent-rgb, 16,185,129),0.35);
    min-height: 50px;
}
.modal-header h3, .modal-header .modal-title { color: #fff; font-size: 15.5px; font-weight: 700; margin: 0; }
.modal-close { color: rgba(255,255,255,0.92); }
.modal-close:hover { background: rgba(255,255,255,0.18); color: #fff; }
.modal-overlay { background: rgba(2,6,23,0.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); align-items: center; justify-content: center; }
/* Any modal text input stays on the dark input background — never white */
.modal input[type="text"], .modal input[type="number"], .modal input[type="date"], .modal input[type="time"],
.modal input[type="email"], .modal input[type="password"], .modal input[type="tel"], .modal input[type="url"],
.modal input[type="search"], .modal input[type="month"], .modal textarea, .modal select,
.modal .form-control { background: var(--bg-input, #0f172a); color: var(--text-primary, #f1f5f9); }
.modal select option { background: var(--bg-card, #1e293b); color: var(--text-primary, #f1f5f9); }
.modal table { background: transparent; }
@media (max-width: 768px) { .modal { --modal-pad: 16px; border-radius: 14px; } .modal-header { border-radius: 13px 13px 0 0; padding: 12px 16px; margin-bottom: 14px; } }
@media (max-width: 480px) { .modal { --modal-pad: 14px; } .modal-header { padding: 11px 14px; } }

/* --- Navbar: tinted by brand palette (v47) --- */
.navbar { background: var(--bg-card, #1e293b); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.navbar-nav a, .navbar-nav button { position: relative; font-weight: 500; }
.navbar-nav a:hover, .navbar-nav button:hover { transform: translateY(-1px); }
.navbar-nav a.active { font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

/* --- Buttons: premium gradient on primary, lift on hover --- */
.btn-primary { background: linear-gradient(135deg, var(--accent, #10b981), var(--accent-dark, #059669)); box-shadow: 0 2px 8px rgba(var(--accent-rgb, 16,185,129),0.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(var(--accent-rgb, 16,185,129),0.4); }
.btn { letter-spacing: 0.1px; }

/* --- Cards: soft elevation --- */
.card { box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.3); }

/* --- Inputs: consistent focus ring --- */
.form-control:focus, .search-input:focus { box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 16,185,129),0.15); }

/* --- Color picker row (Admin → Settings) --- */
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* --- Custom scrollbars (webkit) --- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* --- Smooth page entrance --- */
.container { animation: wmsPageIn 0.35s ease both; }
@keyframes wmsPageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
    .container { animation: none; }
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ============================================================
   PRINT — v42: readable paper output for ANY page printed with
   window.print() (was: light-gray text on white = blank printout)
   ============================================================ */
@media print {
    .navbar, .tabs, .tab-pills, .btn, .modal-overlay, #toast-container, .no-print, .nav-toggle,
    .quick-bar, .search-bar, .filter-count, .proj-actions-dropdown, .lang-toggle-nav { display: none !important; }
    body { background: white !important; color: #000 !important; }
    .card { border: 1px solid #ccc; box-shadow: none; background: white !important; }
    /* Force dark readable text on paper (app is dark-themed on screen) */
    body *, td, th, h1, h2, h3, h4, h5, h6, p, span, div, li, label, strong, b { color: #111 !important; }
    table th { background: #f1f5f9 !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    td { border-bottom: 1px solid #ddd !important; }
    .tab-content { display: none !important; }              /* print what you SEE: */
    .tab-content.active { display: block !important; }      /* only the active tab */
    .prod-card-actions, .mov-type { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { text-decoration: none; color: #111 !important; }
}

/* ============================================================
   v56 — UI REDESIGN (Professional, Modern, Clean, Compact)
   ------------------------------------------------------------
   Goal: bring the app closer to Odoo / Lexin-grade stock
   management UX — tighter spacing, refined typography, flatter
   buttons, subtler borders, professional tables, compact
   filter bars, and small KPI cards.

   CRITICAL: this entire section is ADDITIVE. Every selector
   either overrides a token value or refines an existing class
   without renaming it. No DOM structure or JS hook is removed.
   The backend, the data-attributes, the onclick handlers, the
   permission checks, the security flow, the API contracts — all
   untouched. Existing class names keep working.
   ============================================================ */

/* ---- 1. Typography refinement (Inter-like, tighter hierarchy) ---- */
body {
    font-family: 'Inter', 'Segoe UI', 'Noto Sans', Tahoma, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.45;
}
h1, h2, h3, h4 { letter-spacing: -0.012em; }
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
.card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.005em; }

/* ---- 2. Tighter, cleaner container ---- */
.container { max-width: 1400px; padding: 18px 22px; }
@media (max-width: 768px) { .container { padding: 14px 12px; } }
@media (max-width: 480px) { .container { padding: 12px 8px; } }

/* ---- 3. Refined cards (less padding, subtler borders, soft shadow) ---- */
.card {
    padding: 16px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
    margin-bottom: 14px;
}
.card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.22); }
.card-header { margin-bottom: 12px; gap: 10px; }

/* ---- 4. Refined buttons (flat, no gradients, smaller, consistent) ---- */
.btn {
    border-radius: 7px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
    box-shadow: none;
    border: 1px solid transparent;
    line-height: 1.2;
}
.btn:hover { transform: none; box-shadow: none; }
.btn-primary {
    background: var(--accent);
    color: var(--on-accent, #fff);
    border-color: var(--accent-dark);
}
.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}
.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover { background: var(--border-hover); border-color: var(--border-hover); }
.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-warning {
    background: #d97706;
    color: white;
    border-color: #d97706;
}
.btn-warning:hover { background: #b45309; border-color: #b45309; }
.btn-info {
    background: #0284c7;
    color: white;
    border-color: #0284c7;
}
.btn-info:hover { background: #0369a1; border-color: #0369a1; }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-ghost:hover { background: var(--border-color); color: var(--text-primary); border-color: var(--border-hover); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: 0.45; }

/* ---- 5. Refined modals — clean header, no aggressive gradient ---- */
.modal {
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 4px 16px rgba(0,0,0,0.35);
    padding: var(--modal-pad, 18px);
}
.modal-header {
    background: var(--bg-card);
    margin: calc(-1 * var(--modal-pad, 18px)) calc(-1 * var(--modal-pad, 18px)) 14px;
    padding: 14px 18px;
    border-radius: 13px 13px 0 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
    position: sticky;
    top: calc(-1 * var(--modal-pad, 18px));
    z-index: 3;
    min-height: 48px;
}
.modal-header h3, .modal-header .modal-title {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}
.modal-close {
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 20px;
    line-height: 1;
}
.modal-close:hover { background: var(--border-color); color: var(--text-primary); }
.modal-overlay { background: rgba(2,6,23,0.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

/* ---- 6. Refined forms — better labels, tighter inputs ---- */
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    letter-spacing: 0.01em;
}
.form-control {
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.4;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 16,185,129), 0.14);
}
.form-control::placeholder { color: var(--text-muted); font-size: 13px; }
.form-row { gap: 12px; }
.form-row-3 { gap: 12px; }

/* ---- 7. NEW: Professional data table with sticky header ---- */
.wms-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    background: transparent;
}
.wms-table thead th {
    background: var(--bg-base);
    color: var(--text-secondary);
    padding: 9px 12px;
    text-align: start;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
.wms-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(51,65,85,0.4);
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap;
}
.wms-table tbody td.wrap { white-space: normal; }
.wms-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.wms-table tbody tr:last-child td { border-bottom: none; }
.wms-table-img { width: 32px; height: 32px; object-fit: cover; border-radius: 5px; border: 1px solid var(--border-color); }
.wms-table-img-ph {
    width: 32px; height: 32px; background: var(--bg-base); border-radius: 5px;
    border: 1px solid var(--border-color); display: inline-flex;
    align-items: center; justify-content: center; color: var(--text-muted); font-size: 14px;
}
.wms-table .col-num { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.wms-table .col-actions { text-align: center; white-space: nowrap; }
.wms-table .col-actions .btn-sm { padding: 4px 8px; }

/* ---- 8. NEW: Compact filter bar (single row, all filters together) ---- */
.wms-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 12px;
}
.wms-filter-bar .search-input,
.wms-filter-bar .form-control {
    width: auto;
    min-width: 120px;
    padding: 7px 11px;
    font-size: 13px;
    border-radius: 6px;
}
.wms-filter-bar .search-input { flex: 1; min-width: 160px; }
.wms-filter-bar .btn-sm { padding: 7px 11px; }
.wms-filter-bar .filter-count {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 14px;
}
@media (max-width: 768px) {
    .wms-filter-bar { padding: 8px 10px; }
    .wms-filter-bar .search-input, .wms-filter-bar .form-control { min-width: 100px; font-size: 12px; }
}

/* ---- 9. NEW: Small KPI cards (dashboard-style) ---- */
.wms-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.wms-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 13px 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.15s, background 0.15s;
}
.wms-kpi:hover { border-color: var(--accent); }
.wms-kpi-label {
    font-size: 10.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}
.wms-kpi-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.wms-kpi.accent  .wms-kpi-value { color: var(--accent); }
.wms-kpi.danger  .wms-kpi-value { color: #f87171; }
.wms-kpi.warning .wms-kpi-value { color: #fbbf24; }
.wms-kpi.info    .wms-kpi-value { color: #60a5fa; }
.wms-kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
@media (max-width: 768px) {
    .wms-kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .wms-kpi { padding: 11px 12px; }
    .wms-kpi-value { font-size: 19px; }
}

/* ---- 10. NEW: Movement type chips (clean visual distinction) ---- */
.wms-tx-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.wms-tx-chip.in  { background: rgba(var(--accent-rgb, 16,185,129), 0.15);  color: var(--accent); }
.wms-tx-chip.out { background: rgba(220, 38, 38, 0.15);                    color: #f87171; }
.wms-tx-chip.ret { background: rgba(59, 130, 246, 0.15);                   color: #60a5fa; }
.wms-tx-chip.loan{ background: rgba(124, 58, 237, 0.15);                   color: #a78bfa; }
.wms-tx-chip.adj { background: rgba(245, 158, 11, 0.15);                  color: #fbbf24; }

/* ---- 11. Refined tab-pills (already sidebar from v55 — polish) ---- */
.tab-pill {
    padding: 9px 14px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 8px;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.tab-pill:hover { border-color: var(--border-hover); }
.tab-pill.active {
    background: var(--accent);
    color: var(--on-accent, #fff);
    border-color: var(--accent);
}
.proj-shell .tab-pill.active { box-shadow: 0 2px 8px rgba(var(--accent-rgb, 16,185,129), 0.25); }

/* ---- 12. Refined stat-card (dashboard projects grid) ---- */
.stat-card { padding: 16px; border-radius: 10px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }

/* ---- 13. Refined badges ---- */
.badge { padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }

/* ---- 14. Refined empty state ---- */
.empty-state { padding: 32px 16px; }
.empty-state .icon { font-size: 36px; margin-bottom: 8px; opacity: 0.65; }
.empty-state p { font-size: 13px; color: var(--text-muted); }

/* ---- 15. Refined project-card (dashboard) ---- */
.project-card {
    padding: 16px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.project-card::before { display: none; }
.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.32);
}
.project-card-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.project-card-company { font-size: 12px; margin-bottom: 2px; }
.project-card-city { font-size: 11px; }

/* ---- 16. Rined list-row (rows-wrap / inv-card / sortie-card) ---- */
.list-row {
    padding: 10px 8px;
    gap: 10px;
    border-bottom: 1px solid rgba(51,65,85,0.4);
    transition: background 0.12s;
}
.list-row:hover { background: rgba(255,255,255,0.025); }
.list-row:last-child { border-bottom: none; }
.rows-head {
    font-size: 10.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}
.prod-card-name { font-size: 13px; font-weight: 600; }
.prod-card-sku { font-size: 11px; color: var(--text-muted); }

/* ---- 17. Refined inputs (search-input / select) ---- */
.search-input {
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 13.5px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 16,185,129), 0.14);
}
select.form-control {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%2394a3b8' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: left 10px center;
    padding-left: 28px;
    appearance: none;
    -webkit-appearance: none;
}
[dir="rtl"] select.form-control {
    background-position: right 10px center;
    padding-left: 12px;
    padding-right: 28px;
}

/* ---- 18. Refined mov-row (already structured in v55) ---- */
.mov-row {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-base);
    margin-bottom: 6px;
    gap: 10px;
    transition: border-color 0.12s, background 0.12s;
}
.mov-row:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.02); }
.mov-row .mov-type {
    width: 32px; height: 32px; border-radius: 7px; font-size: 14px;
}
.mov-row .mov-product {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.mov-row .mov-product .mov-product-name { font-weight: 700; color: var(--text-primary); }
.mov-row .mov-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.mov-row .mov-qty { font-size: 15px; font-weight: 700; min-width: 56px; font-variant-numeric: tabular-nums; }

/* ---- 19. Refined page-header ---- */
.page-header { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.page-header h1 { font-size: 19px; }
.page-header .breadcrumb { font-size: 12px; }

/* ---- 20. Refined quick-bar (filter chip row inside tabs) ---- */
.quick-bar {
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 12px;
    gap: 8px;
}

/* ---- 21. Refined summary cards (entree-summary-grid) ---- */
.entree-summary-grid {
    gap: 8px;
    margin-bottom: 14px;
}
.entree-sum-card {
    padding: 12px 14px;
    border-radius: 9px;
}
.entree-sum-card .sum-icon { font-size: 18px; }
.entree-sum-card .sum-val { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.entree-sum-card .sum-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }

/* ---- 22. Custom scrollbar refinements ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ---- 23. Print refinements ---- */
@media print {
    .wms-filter-bar, .quick-bar, .tab-pills, .no-print { display: none !important; }
    .wms-table thead th { background: #f1f5f9 !important; color: #111 !important; }
    .wms-table tbody td { color: #111 !important; border-bottom: 1px solid #ddd !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ============================================================
   v58 — EXCEL MODE : جداول حقيقية بأسلوب Excel
   ------------------------------------------------------------
   Each field lives in ITS OWN column, exactly under its header:
   صورة | SKU | المرجع | التصمين | الفئة | المخزون | القيمة | دخول | خروج | تعديل | حذف
   Rules:
   1. ONE line per cell — text NEVER wraps under itself (Excel-like).
      Long values get ellipsis "…" instead of a second line.
   2. Headers stay glued on top of their columns (sticky).
   3. Action buttons NEVER wrap to a second row — each action has
      its own column (دخول تحت الدخول، الخروج تحت الخروج،
      التعديل تحت التعديل، الحذف تحت الحذف).
   4. If the table is wider than the screen → horizontal scroll
      inside .table-wrapper (columns NEVER squeeze or shift).
   ============================================================ */

/* ---- Base table: Excel-like geometry ---- */
table { border-collapse: collapse; }
thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-base);
    text-align: start;
    box-shadow: inset 0 -2px 0 var(--accent, #10b981);
}
th, td { white-space: nowrap; }
td {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
    font-variant-numeric: tabular-nums;
}
/* escape hatch: cells that are ALLOWED to wrap (long descriptions) */
td.wrap, th.wrap { white-space: normal; overflow: visible; text-overflow: clip; }

/* zebra rows + clear column borders (Excel grid feel) */
tbody tr:nth-child(even) td { background: rgba(255,255,255,0.015); }

/* action & icon columns — fixed equal width, always centered */
th.col-act, td.col-act { width: 64px; min-width: 64px; max-width: 64px; text-align: center !important; overflow: visible; }
th.col-img, td.col-img { width: 58px; min-width: 58px; max-width: 58px; text-align: center !important; }
th.col-num, td.col-num { text-align: center !important; font-variant-numeric: tabular-nums; }

/* mono cells: SKU / references */
td.mono, .mono { font-family: 'Segoe UI', Tahoma, monospace; font-size: 12px; letter-spacing: 0.2px; }

/* buttons inside cells: NEVER wrap, NEVER stretch, keep one per line */
.btn-group { flex-wrap: nowrap; }
.btn-group .btn { flex: 0 0 auto; }
td .btn { flex: 0 0 auto; }
td.col-act .btn-sm, .col-act .btn-sm { padding: 5px 9px; font-size: 13px; line-height: 1; }

/* helper alignment */
.ta-c { text-align: center !important; }
.ta-s { text-align: start !important; }

/* small muted text inline (units, timestamps) */
.td-sub { font-size: 10.5px; color: var(--text-muted); font-weight: 500; }

/* ensure wrappers scroll horizontally instead of squeezing columns */
.table-wrapper { overflow-x: auto; max-width: 100%; }
.table-wrapper table { min-width: max-content; }
.modal .table-wrapper { overflow-x: auto; max-width: 100%; }

/* sticky header offset when table scrolls inside card */
.card > .table-wrapper { border-radius: 8px; }

/* ---- Movements table bits (kept from v57, now inside real <table>) ---- */
.mov-type {
    width: 34px; height: 34px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0;
}
.mov-type.in  { background: rgba(var(--accent-rgb,16,185,129),0.12); }
.mov-type.out { background: rgba(220,38,38,0.12); }
.mov-product-name { font-weight: 600; color: var(--text-primary); }
.mov-qty-cell.in  { color: var(--accent); }
.mov-qty-cell.out { color: #f87171; }
.mov-notes { color: var(--text-secondary); font-size: 12px; }

/* qty cell inside td — neutralize old card margins, keep color logic */
td.prod-card-qty { margin: 0; display: inline-flex; align-items: baseline; gap: 4px; justify-content: center; }
td .qty-num { font-size: 15px; font-weight: 700; }
td .qty-unit { font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
td .prod-card-name { margin: 0; font-size: 13px; }

/* row image inside Excel tables */
.xl-img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-color); }
.xl-img-ph {
    width: 36px; height: 36px; background: var(--bg-base); border-radius: 6px;
    border: 1px solid var(--border-color); display: inline-flex;
    align-items: center; justify-content: center; color: var(--text-muted); font-size: 16px;
}

/* status chips inline in cells (no stacking) */
.status-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700;
    white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.status-chip.ok  { background: rgba(var(--accent-rgb,16,185,129),0.13); color: var(--accent); }
.status-chip.bad { background: rgba(220,38,38,0.13); color: #f87171; }

/* old v43/v57 legacy classes — neutralized so they never create
   stacked flex layouts again */
.rows-head .rh-1, .rows-head .rh-2, .rows-head .rh-3, .rows-head .rh-4 { display: none; }
.list-row, .inv-card, .mov-row, .entree-card, .sortie-card { display: table-row; }
.list-row:hover td, .inv-card:hover td, .mov-row:hover td,
.entree-card:hover td, .sortie-card:hover td { background: rgba(255,255,255,0.03); }

/* print: keep the Excel grid clean */
@media print {
    thead th { position: static; box-shadow: inset 0 -2px 0 #333; }
    .table-wrapper { overflow: visible; }
    td { max-width: none; }
}


