:root {
    --bg-app: #f5f7fa;
    --nav-bg: #ffffff;
    --widget-bg: #ffffff;
    --text-dark: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #e1e8ed;
    --primary: #3498db;
    --primary-light: #ebf5fb;
    --success: #2ecc71;
    --success-bg: #eaeded;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --danger-bg: #fdf2f0;
    --radius: 20px;
}

[data-theme="dark"] {
    --bg-app: #121212;
    --nav-bg: #1e1e1e;
    --widget-bg: #1e1e1e;
    --text-dark: #e0e0e0;
    --text-muted: #9e9e9e;
    --border: #333333;
    --primary: #2980b9;
    --primary-light: #1a252f;
    --success: #27ae60;
    --success-bg: #1e2b22;
    --warning: #f39c12;
    --danger: #c0392b;
    --danger-bg: #2d1a19;
}

* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }

#login-screen {
    display: none; position: fixed; inset: 0; z-index: 2000;
    background: var(--bg-app); align-items: center; justify-content: center;
}
#login-screen.active { display: flex; }
.login-box {
    width: 500px; max-width: 90vw; background: var(--widget-bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 35px; text-align: center;
}
.login-box h1 { font-size: 1.4rem; margin-top: 0; margin-bottom: 20px; }
.login-mode-tabs { margin-bottom: 20px; }
.login-mode-tabs button { flex: 1; }
.login-form { display: flex; flex-direction: column; gap: 12px; }

.header-account-btn {
    position: fixed; top: 0; right: 0; height: 25px; z-index: 201;
    background: rgba(0,0,0,0.18); color: #fff; border: none; padding: 0 16px;
    font-size: 0.85rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px;
}

.password-dots { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.pw-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); display: inline-block; }
.pw-dot.filled { background: var(--primary); border-color: var(--primary); }

.bin-config-block { margin-bottom: 25px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.bin-config-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.date-input-row { display: flex; gap: 15px; align-items: center; margin-bottom: 15px; }
.date-display { flex: 1; padding: 18px; font-size: 1.3rem; font-weight: bold; letter-spacing: 2px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-app); color: var(--text-dark); text-align: center; }
.mini-numpad { display: grid; grid-template-columns: repeat(3, 44px); gap: 6px; }
.mini-numpad button { padding: 10px 0; font-size: 1.1rem; font-weight: bold; border: none; border-radius: 8px; background: var(--widget-bg); color: var(--text-dark); box-shadow: 0 2px 0 var(--border); cursor: pointer; }
.mini-numpad button:active { transform: translateY(2px); box-shadow: none; }
.mini-numpad .btn-danger { color: var(--danger); }
.mini-numpad .btn-warning { color: var(--warning); }

body {
    margin: 0; font-family: 'SF Pro Display', system-ui, sans-serif;
    background: var(--bg-app); color: var(--text-dark);
    display: flex; height: 100vh; padding-top: 25px; box-sizing: border-box; overflow: hidden; -webkit-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.general-header { position: fixed; top: 0; left: 0; width: 100%; height: 25px; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; z-index: 200; }
.general-header.bin-jaune { background: #facc15; color: #422006; }
.general-header.bin-grise { background: #6b7280; }
.bin-jaune, .bin-grise { font-weight: 800; }

main { flex: 1; display: flex; flex-direction: column; overflow: hidden; transition: background 0.3s ease; }

main[data-active-tab="stock"] { background: linear-gradient(180deg, rgba(46, 204, 113, 0.25) 0%, var(--bg-app) 50%); }
main[data-active-tab="consommation"] { background: linear-gradient(180deg, rgba(231, 76, 60, 0.25) 0%, var(--bg-app) 50%); }
main[data-active-tab="courses"] { background: linear-gradient(180deg, rgba(52, 152, 219, 0.25) 0%, var(--bg-app) 50%); }

.app-nav { width: 100px; background: var(--nav-bg); display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--border); z-index: 50; }
.nav-top, .nav-bottom { display: flex; flex-direction: column; gap: 10px; padding: 15px 10px; }
.app-nav button { background: transparent; border: none; padding: 15px 0; border-radius: 15px; color: var(--text-muted); font-size: 0.85rem; font-weight: bold; cursor: pointer; transition: all 0.2s; }
.app-nav button.active { background: var(--primary-light); color: var(--primary); transform: scale(1.05); }

.filters-bar { display: flex; gap: 15px; padding: 15px 25px; background: var(--nav-bg); align-items: center; border-bottom: 1px solid var(--border); }
.btn-filter { flex: 1; padding: 15px; font-size: 1.1rem; font-weight: bold; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-app); color: var(--text-dark); cursor: pointer; text-align: left; }
.btn-icon, .btn-shortcut { background: var(--bg-app); border: none; font-size: 1rem; padding: 12px 20px; border-radius: 12px; cursor: pointer; color: var(--text-dark); font-weight: bold; }

.toggle-container { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.toggle-text { font-size: 0.8rem; font-weight: bold; color: var(--text-muted); }
.modern-toggle input { display: none; }
.toggle-track { width: 50px; height: 26px; background: var(--border); border-radius: 26px; position: relative; transition: 0.3s; }
.toggle-thumb { width: 20px; height: 20px; background: white; border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: 0.3s; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.modern-toggle input:checked + .toggle-track { background: var(--success); }
.modern-toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(24px); }

.segmented-control { display: flex; background: var(--border); padding: 5px; border-radius: 12px; }
.segmented-control button { border: none; background: transparent; padding: 12px 20px; border-radius: 10px; font-size: 1rem; color: var(--text-muted); font-weight:bold; cursor: pointer; }
.segmented-control button.active { background: var(--widget-bg); color: var(--text-dark); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

.tab-content { display: none; height: 100%; flex-direction: column; overflow: hidden; }
.tab-content.active { display: flex; }
.edge-to-edge { padding: 25px; gap: 25px; overflow-y: auto; }
.scrollable-area { padding: 25px; overflow-y: auto; }

/* CORRECTION DU SCROLL POUR LES SOUS-ONGLETS */
.sub-tab-content { display: none; }
.sub-tab-content.active { display: flex; gap: 25px; flex-direction: column; flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 25px; }

.widget-grid-accueil, .widget-grid-dlc { display: flex; flex-direction: column; gap: 25px; }
.accueil-bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.dlc-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 15px; }

.widget { background: var(--widget-bg); border-radius: var(--radius); padding: 25px; display: flex; flex-direction: column; box-shadow: 0 4px 15px rgba(0,0,0,0.03); border: 1px solid var(--border); }
.success-widget { background: var(--success-bg); border: 1px solid rgba(46, 204, 113, 0.3); }
.flex-1 { flex: 1; }
.widget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.inline-header { display: flex; align-items: baseline; gap: 15px; }
.widget-title { font-size: 1.3rem; font-weight: 800; color: var(--text-dark); }
.highlight-title { font-size: 1.6rem; font-weight: 900; color: var(--primary); }

.badge-time { background: var(--primary-light); color: var(--primary); padding: 6px 12px; border-radius: 8px; font-weight: bold; font-size: 0.9rem;}
.badge-frais { background: #e8f8f5; color: #1abc9c; padding: 4px 8px; border-radius: 6px; font-weight: bold; font-size: 0.85rem;}
.badge-dlc-inline { background: var(--border); color: var(--text-dark); padding: 3px 8px; border-radius: 6px; font-weight: bold; font-size: 0.85rem; margin-left: 8px;}
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }

.dlc-configurator { display: flex; align-items: center; background: var(--bg-app); border-radius: 12px; padding: 4px; }
.dlc-configurator button { background: var(--widget-bg); border: none; border-radius:8px; color: var(--text-dark); font-weight: bold; font-size: 1.2rem; padding: 5px 15px; cursor: pointer; }
.dlc-configurator span { font-weight: 900; color: var(--danger); min-width: 40px; text-align: center; }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.list-layout, .list-scroll { display: flex; flex-direction: column; gap: 12px; }
.list-scroll { overflow-y: auto; flex: 1; padding-right: 5px; }
.horizontal-scroll { flex-direction: row; overflow-x: auto; white-space: nowrap; padding-bottom: 10px; }

/* CARTES PRODUITS */
.product-card { background: var(--widget-bg); border-radius: var(--radius); text-align: center; padding: 15px; padding-top: 0; position: relative; cursor: pointer; border: 1px solid var(--border); transition: transform 0.1s; display: flex; flex-direction: column; }
.product-card:active { transform: scale(0.96); }
.product-card > img { width: calc(100% + 30px); height: 130px; object-fit: cover; margin-left: -15px; margin-right: -15px; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: 15px;}
.product-category-badge { position: absolute; top: 98px; left: 12px; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--bg-app); color: var(--text-dark); padding: 4px 8px; border-radius: 8px; font-size: 0.8rem; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.product-dlc-badge { position: absolute; top: 98px; right: 12px; background: var(--widget-bg); color: var(--text-dark); padding: 4px 8px; border-radius: 8px; font-size: 0.8rem; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.2); white-space: nowrap; }
.product-dlc-badge.expired { background: var(--danger); color: #fff; }
.product-card.in-cart { background: var(--success-bg); border-color: var(--success); opacity: 0.9; }
.product-card.expired { background: var(--danger-bg); border-color: var(--danger); }

.line-item { display: flex; align-items: center; justify-content: space-between; background: var(--widget-bg); padding: 15px; border-radius: 16px; cursor: pointer; border: 1px solid var(--border); }
.product-thumbnail { width: 60px; height: 60px; flex: 0 0 60px; border-radius: 12px; object-fit: cover; margin-right: 15px; }
.line-item.in-cart { background: var(--success-bg); border-color: var(--success); }
.line-item.expired { background: var(--danger-bg); border-color: var(--danger); }

.card-info-row { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; font-size: 0.85rem; color: var(--text-muted); font-weight: bold;}
.conditionnement-display { display: inline-flex; align-items: center; gap: 5px; }
.conditionnement-display img, .conditionnement-option img { width: 42px; height: 42px; object-fit: contain; }
.conditionnement-option { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.card-info-row .conditionnement-display img { width: 46px; height: 46px; }
.filter-option .conditionnement-display img { width: 64px; height: 64px; }
.btn-filter .conditionnement-display { gap: 8px; }
.btn-filter .conditionnement-display img { width: 30px; height: 30px; }
.mini-badge .conditionnement-display img { width: 28px; height: 28px; }

.stock-badge { position: absolute; top: 12px; right: 12px; padding: 6px 14px; border-radius: 12px; font-weight: 900; color:white; font-size: 1.1rem; box-shadow: 0 2px 5px rgba(0,0,0,0.2);}
.vignette-dlc { background: var(--danger); padding: 6px 12px; border-radius: 12px; color: white; font-weight: 900; font-size: 1rem;}
.line-item .stock-badge { position: static; box-shadow: none;}

.stock-good { background: var(--success); }
.stock-warning { background: var(--warning); }
.stock-empty { background: var(--danger); }

/* Détails Produits dans Gérer */
.card-detailed { display: flex; align-items: center; background: var(--widget-bg); padding: 15px; border-radius: 16px; border: 1px solid var(--border); cursor: pointer; }
.card-detailed > img { width: 70px; height: 70px; border-radius: 12px; object-fit: cover; margin-right: 20px; }
.card-detailed-info { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card-detailed-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.mini-badge { background: var(--bg-app); border: 1px solid var(--border); padding: 4px 8px; border-radius: 6px; font-size: 0.8rem; font-weight: bold; color: var(--text-muted); cursor: default; }
.mini-badge.missing-dlc { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); cursor: pointer; }
.disabled-product { opacity: 0.55; }
.disabled-badge { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

.dlc-lot-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.dlc-lot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg-app); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-weight: bold; color: var(--text-dark); cursor: pointer; }
.dlc-lot-row.missing-dlc { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.dlc-lot-row:active { transform: scale(0.98); }
.product-active-toggle { display: flex; align-items: center; gap: 10px; margin: 0 0 15px; font-weight: bold; color: var(--text-dark); cursor: pointer; }
.product-active-toggle input { width: 22px; height: 22px; accent-color: var(--success); cursor: pointer; }

/* Z-INDEX MODALS : Assurer le bon empilement (au-dessus de l'écran de connexion à 2000) */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); overflow-y: auto; z-index: 100;}
#edit-prod-modal { z-index: 110; }
#plan-action-modal { z-index: 110; }
#multi-select-modal { z-index: 1003; }
#list-modal { z-index: 1004; }
#keyboard-modal { z-index: 2010; }
#password-modal { z-index: 2011; }

.modal-content { background: var(--bg-app); border-radius: 24px; padding: 30px; box-shadow: 0 15px 50px rgba(0,0,0,0.3); position: relative; margin: 5% auto; max-width: 90%; display: flex; flex-direction: column;}
.list-modal-content { width: 850px; }
.list-modal-content #list-modal-container { flex: none; }
.list-modal-actions { margin-top: 18px; }
.category-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-content: start; }
.condition-filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; overflow: visible; padding-right: 0; }
.condition-filter-grid .all-conditionnements-option { grid-column: 1 / -1; }
.condition-filter-grid .filter-option { display: flex; align-items: center; justify-content: center; min-height: 76px; }
.condition-filter-grid .filter-option .conditionnement-display { justify-content: center; }
.filter-option { width: 100%; text-align: left; }
.btn-secondary.all-conditionnements-option { background: var(--primary); border-color: var(--primary); color: white; }
@media (max-width: 650px) { .category-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.split-modal-container { display: flex; gap: 30px; width: 100%; margin-bottom: 20px;}
.split-left { flex: 1; display: flex; flex-direction: column; gap: 20px; }
.split-right { flex: 1; }

.search-header { display: flex; gap: 15px; }
.large-search { font-size: 1.5rem; padding: 20px; }

.azerty-keyboard { display: flex; flex-direction: column; gap: 12px; background: var(--widget-bg); padding: 20px; border-radius: var(--radius); }
.k-row { display: flex; justify-content: center; gap: 10px; }
.k-row button { flex: 1; padding: 18px 0; font-size: 1.3rem; font-weight: bold; border-radius: 12px; border: none; background: var(--bg-app); color: var(--text-dark); box-shadow: 0 3px 0 var(--border); cursor: pointer; }
.k-row button:active { transform: translateY(3px); box-shadow: none; }
.k-row .k-special { background: #bdc3c7; color: #2c3e50; }
.k-row .k-space { flex: 5; }

.input-box { background: var(--widget-bg); padding: 20px; border-radius: var(--radius); text-align: center; border: 2px solid var(--border); cursor: pointer; }
.input-box.active-box { border-color: var(--primary); background: var(--primary-light); }
.box-label { display: block; font-size: 1.1rem; font-weight: bold; color: var(--text-muted); margin-bottom: 10px; }
.val-display { font-size: 3.5rem; font-weight: 900; color: var(--text-dark); }
.dlc-val { font-size: 1.5rem; color: var(--primary); }

.qty-controls { display: flex; align-items: center; justify-content: center; gap: 25px; }
.btn-round-small { width: 50px; height: 50px; border-radius: 50%; background: var(--bg-app); font-size: 1.5rem; border: none; font-weight: bold; color: var(--text-dark); box-shadow: 0 2px 5px rgba(0,0,0,0.1); cursor:pointer;}

.numpad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.numpad-grid button { padding: 22px 0; font-size: 2.2rem; border-radius: 16px; border: none; background: var(--widget-bg); font-weight: bold; color: var(--text-dark); box-shadow: 0 3px 0 var(--border);}
.numpad-grid button:active { transform: translateY(3px); box-shadow: none; }
.numpad-grid .btn-danger { color: var(--danger); }
.numpad-grid .btn-warning { color: var(--warning); }

.modal-actions-bot { display: flex; gap: 15px; width: 100%;}
.btn-primary { flex:1; background: var(--primary); color: white; border:none; padding:15px; border-radius:12px; font-size: 1.1rem; font-weight:bold; cursor: pointer; text-align:center;}
.btn-secondary { flex:1; background: var(--widget-bg); color: var(--text-dark); border:2px solid var(--border); padding:15px; border-radius:12px; font-size: 1.1rem; font-weight:bold; cursor: pointer; text-align:center;}
.btn-danger { flex:1; background: var(--danger); color: white; border:none; padding:15px; border-radius:12px; font-size: 1.1rem; font-weight:bold; cursor: pointer; text-align:center;}
.btn-frais { background: #1abc9c; color: white; border:none; padding:12px; border-radius:12px; font-weight:bold; cursor: pointer; width: 100%; margin-top: 10px;}

.tactile-input { width: 100%; padding: 18px; font-size: 1.1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--widget-bg); color: var(--text-dark); box-sizing: border-box; margin-bottom: 12px; cursor: pointer;}

/* Groupes de boutons Edition Produit */
.btn-group-row { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap;}
.btn-select { flex: 1; padding: 12px; border-radius: 10px; border: 2px solid var(--border); background: var(--bg-app); font-weight: bold; color: var(--text-muted); cursor: pointer; text-align: center; }
.btn-select.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

.edit-qty-row { display: flex; align-items: center; justify-content: space-between; background: var(--bg-app); padding: 10px 15px; border-radius: 12px; margin-bottom: 15px;}
.edit-qty-row span { font-weight: bold; color: var(--text-muted); }

/* Catégories Grid */
.cats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.cat-card { background: var(--widget-bg); border: 1px solid var(--border); border-radius: 12px; padding: 15px; text-align: center; cursor: pointer; font-size: 1.1rem; font-weight: bold;}
.cat-color-swatch { width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 8px; }
.cat-color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.cat-badge { display: inline-block; padding: 4px 10px; border-radius: 8px; color: #fff; font-weight: bold; font-size: 0.8rem; }

/* Planning Elements (Responsive sans Scroll) */
.planning-container { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; flex: 1; }
.day-card { background: var(--bg-app); border-radius: 12px; display: flex; flex-direction: column; border: 1px solid var(--border); overflow:hidden; min-width: 0; }
.day-header { padding: 10px 5px; text-align: center; font-weight: bold; font-size: 1rem; border-bottom: 1px solid var(--border); background: var(--widget-bg);}
.day-header.today { background: var(--primary); color: white; border-bottom:none;}
.meal-slot { flex: 1; padding: 10px; display: flex; flex-direction: column; position: relative; justify-content: flex-start;}
.meal-slot h4 { margin: 0 0 8px 0; color: var(--text-dark); font-size: 1rem; line-height: 1.2;}
.meal-details { color: var(--text-muted); font-size: 0.85rem; font-weight: bold; line-height: 1.4; word-wrap: break-word;}
.btn-add-meal-slot { margin-top: auto; background: var(--primary-light); color: var(--primary); border: none; padding: 8px; border-radius: 8px; font-weight: bold; cursor: pointer; width: 100%; font-size: 0.9rem;}
.btn-edit-meal-slot { position: absolute; top: 10px; right: 10px; background: var(--border); border: none; border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 0.8rem;}

.overused-ingredient { color: var(--danger); font-weight: 900; text-decoration: underline; }
.planning-warning-box { margin-top: 15px; background: var(--danger-bg); border-left: 4px solid var(--danger); padding: 15px; border-radius: 10px; font-weight: bold; color: var(--danger); }

@media (max-width: 1024px) {
    .app-nav { width: 84px; }
    .nav-top, .nav-bottom { padding: 12px 8px; gap: 6px; }
    .app-nav button { padding: 12px 0; font-size: 0.75rem; }
    .filters-bar { flex-wrap: wrap; gap: 10px; padding: 12px 18px; }
    .btn-filter { min-width: 190px; padding: 12px; font-size: 1rem; }
    .edge-to-edge, .scrollable-area { padding: 18px; gap: 18px; }
    .widget { padding: 18px; }
    .accueil-bottom-row { gap: 18px; }
    .app-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
    .dlc-columns { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .list-modal-content { width: min(850px, 90vw); }
}

@media (max-width: 700px) {
    body { display: block; height: 100dvh; padding-top: 25px; overflow: hidden; }
    main { width: 100%; height: 100%; padding-bottom: 70px; box-sizing: border-box; }
    .general-header { justify-content: flex-start; padding: 0 10px; padding-right: 90px; box-sizing: border-box; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-account-btn { font-size: 0.7rem; padding: 0 10px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .app-nav { position: fixed; right: 0; bottom: 0; left: 0; width: auto; height: 70px; flex-direction: row; justify-content: flex-start; overflow-x: auto; border-top: 1px solid var(--border); border-right: 0; z-index: 50; }
    .nav-top, .nav-bottom { display: contents; }
    .app-nav button { flex: 0 0 68px; min-height: 70px; padding: 6px 2px; border-radius: 0; font-size: 0.66rem; }
    .app-nav button.active { transform: none; box-shadow: inset 0 3px 0 var(--primary); }

    .filters-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 10px 12px; align-items: stretch; }
    .filters-bar .btn-icon { grid-column: 1 / -1; }
    .btn-filter, .btn-icon, .btn-shortcut { min-width: 0; padding: 11px; font-size: 0.85rem; white-space: normal; overflow-wrap: break-word; line-height: 1.25; text-align: center; }
    .toggle-container { flex-direction: row; justify-content: center; }
    .segmented-control { justify-content: center; }
    .segmented-control button { padding: 10px 8px; white-space: normal; overflow-wrap: break-word; line-height: 1.2; font-size: 0.85rem; }

    #produits > div:first-child { padding: 12px 12px 0 !important; }
    #produits > div:first-child .segmented-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100% !important; }
    #produits > div:first-child .segmented-control button { min-width: 0; padding: 10px 8px; white-space: normal; overflow-wrap: break-word; overflow: visible; text-overflow: clip; line-height: 1.2; }
    .sub-tab-content.active { gap: 12px; padding-bottom: 12px; }
    .edge-to-edge, .scrollable-area { padding: 12px; gap: 12px; }
    .widget-grid-accueil, .widget-grid-dlc { gap: 12px; }
    .widget { padding: 15px; border-radius: 12px; }
    .accueil-bottom-row { grid-template-columns: 1fr; gap: 12px; }
    .widget-header { align-items: flex-start; gap: 12px; flex-direction: column; margin-bottom: 14px; }
    .inline-header { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
    .widget-title { font-size: 1.1rem; }
    .highlight-title { font-size: 1.3rem; }
    .app-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
    .product-card img { height: 110px; }
    .product-category-badge { top: 78px; }
    .product-dlc-badge { top: 78px; }
    .line-item { padding: 12px; }
    .product-thumbnail { width: 48px; height: 48px; flex-basis: 48px; margin-right: 10px; }
    .card-detailed { align-items: flex-start; padding: 12px; }
    .card-detailed img { width: 56px; height: 56px; margin-right: 12px; }
    .cats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .dlc-columns { grid-template-columns: 1fr; gap: 10px; }

    .planning-container { grid-template-columns: 1fr; min-width: 0; gap: 12px; }
    #planning .widget, #manage-planning .widget { overflow-x: visible; }
    .day-card { min-height: 220px; }
    #manage-repas > div { flex-direction: column !important; gap: 12px !important; height: auto !important; }
    #manage-repas > div > .widget { width: auto !important; }

    .modal { padding: 12px; box-sizing: border-box; }
    .modal-content, .list-modal-content { width: 100% !important; max-width: none; margin: 0 auto 80px; padding: 20px; border-radius: 16px; box-sizing: border-box; }
    .list-modal-content .list-scroll { margin-bottom: 16px; }
    .category-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .filter-option { padding: 12px 10px; font-size: 0.9rem; white-space: normal; overflow-wrap: break-word; line-height: 1.25; }
    .split-modal-container { flex-direction: column; gap: 15px; }
    .azerty-keyboard { gap: 7px; padding: 10px; border-radius: 12px; }
    .k-row { gap: 6px; }
    .k-row button { padding: 13px 0; font-size: 1rem; border-radius: 8px; }
    .search-header { gap: 8px; }
    .large-search { padding: 14px; font-size: 1.1rem; }
    .modal-actions-bot { gap: 8px; flex-wrap: wrap; }
    .modal-actions-bot > button { flex: 1 1 100%; }
    .btn-primary, .btn-secondary, .btn-danger { padding: 12px 8px; font-size: 0.95rem; }
    .edit-qty-row { gap: 10px; align-items: center; }
    .btn-round-small { width: 42px; height: 42px; font-size: 1.25rem; }

    .date-input-row { flex-direction: column; align-items: stretch; }
    .mini-numpad { grid-template-columns: repeat(3, 1fr); width: 100%; }
    .dlc-lot-row { flex-wrap: wrap; row-gap: 4px; }
}

@media (max-width: 430px) {
    .app-nav button { flex-basis: 52px; font-size: 0; }
    .app-nav button::first-line { font-size: 1rem; }
    #produits > div:first-child .segmented-control button { font-size: 0.72rem; }
    .header-account-btn { max-width: 60px; }
    .general-header { padding-right: 66px; }
    .mini-numpad { grid-template-columns: repeat(3, 1fr); gap: 5px; }
    .mini-numpad button { padding: 8px 0; font-size: 1rem; }
}