:root {
    --primary: #009688;
    --primary-hover: #00796b;
    --bg-color: #f4f6f8;
    --panel-bg: #ffffff;
    --text: #333333;
    --border: #e2e8f0;
    --danger: #e53e3e;
}

* { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background-color: var(--bg-color); color: var(--text); margin: 0; padding: 15px; }
.container { max-width: 1000px; margin: 0 auto; }
h1 { text-align: center; color: var(--primary); margin-bottom: 30px; }
h2 { font-size: 1.2rem; margin-top: 0; border-bottom: 2px solid var(--border); padding-bottom: 10px;}

.panel { background: var(--panel-bg); padding: 20px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 20px; }
.form-group { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
input, select { flex: 1; min-width: 120px; padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; }

button { background-color: var(--primary); color: white; border: none; padding: 12px 20px; border-radius: 6px; cursor: pointer; font-weight: bold; width: 100%; transition: 0.2s; }
button:hover { background-color: var(--primary-hover); }

.import-section { background: #e6f2f1; padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px dashed var(--primary); }
.import-section label { display:block; margin-bottom:5px; font-weight:bold; color: var(--primary); }
.import-flex { display: flex; gap: 10px; }
#btn-import { width: auto; background-color: #0f172a; }
.variant-picker { margin-top: 10px; }
.variant-picker label { margin-bottom: 4px; color: #0f172a; }
#variant-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background-color: #f8fafc; color: #475569; font-weight: 600; }

.header-list { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.header-list h2 { margin-bottom: 0; border-bottom: none; padding-bottom: 0; margin-right: auto; }
.sort-controls { display: flex; align-items: center; gap: 8px; }
.sort-controls label { font-size: 0.9rem; color: #475569; font-weight: 600; }
.sort-controls select { min-width: 90px; padding: 7px 8px; flex: initial; }
#search-bar { min-width: 180px; flex: initial; }

.thumb-img { width: 45px; height: 45px; object-fit: cover; border-radius: 5px; border: 1px solid var(--border); background: #fff;}
.action-btns { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.btn-icon { width: 30px; height: 30px; padding: 0; display: inline-flex; justify-content: center; align-items: center; font-size: 0.9rem; }
.btn-icon i { display: block; line-height: 1; }
.btn-danger { background-color: var(--danger); }
.btn-danger:hover { background-color: #c53030; }
.shop-link { color: var(--primary); font-size: 1.2rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;}
.shop-link i { line-height: 1; }
.shop-price-cell { white-space: nowrap; }
.shop-price { display: inline-flex; align-items: center; gap: 6px; line-height: 1.1; }
.shop-price .price-per-kg { font-size: 0.95rem; color: #334155; }

#import-status { display: inline-flex; align-items: center; gap: 6px; }
#import-status i { line-height: 1; }

/* Calculateur */
.calc-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.calc-row select { flex: 2; }
.calc-row input { flex: 1; }
.btn-remove-row { width: auto; background: var(--danger); padding: 10px 15px; }

.depleted-panel { opacity: 0.8; }
.depleted-panel th { background-color: #fee2e2; }

@media (max-width: 768px) {
    .sort-controls { width: 100%; }
    .sort-controls select { flex: 1; }
    #search-bar { flex: 1; min-width: 100%; }
    .import-flex { flex-direction: column; }
    #btn-import { width: 100%; }
    .variant-picker { overflow: hidden; }
}