
* { box-sizing: border-box; }
body {
    font-family: Arial, sans-serif;
    background: linear-gradient(#000033,#77b5fe,#000033);
    background-attachment: fixed;
    color: #ffffff;
    margin: 0;
    padding: 10px 5px;
    text-align: center;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: rgba(18,18,30,0.95);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #333;
}
h1 { color: #77b5fe; text-align: center; margin: 8px 0 2px; font-size: 1.5em; }
h2 { color: #77b5fe; text-align: center; margin: 10px 0 8px; font-size: 1.2em; border-bottom: 1px solid #333; padding-bottom: 6px; }
.version { text-align: center; font-size: 0.82em; color: #888; margin-top: 0; margin-bottom: 10px; }
.version span { font-weight: bold; color: #77b5fe; }
.onglets { width: 100%; max-width: 440px; margin: 6px auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.Bonglet { border: none; background-color: rgba(255,255,255,0.08); border-radius: 6px; padding: 8px 6px; min-width: 0; min-height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #ccc; text-decoration: none; text-align: center; font-size: 0.95em; font-weight: 500; line-height: 1.1; transition: background 0.2s, color 0.2s; }
.Bonglet:hover { background-color: rgba(255,255,255,0.15); color: #fff; }
.Bonglet.active { background-color: #007bff; color: #fff; font-weight: bold; }
.Bonglet.active:hover { background-color: #0069d9; }
#pied { display: flex; justify-content: space-between; font-size: 11px; margin-top: 12px; padding-top: 8px; border-top: 1px solid #333; color: #666; }
.section { display: none; padding: 10px 0; margin-top: 0; background-color: transparent; width: 100%; }
.section.active { display: block; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.status-subscription { margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(119,181,254,0.28); }
.status-subscription h4 { margin: 3px 0 6px; color: #77b5fe; font-size: 0.92em; }
.status-subscription p { margin: 3px 0; font-size: 0.84em; }
.status-total-block { margin-top: 8px; padding-top: 7px; border-top: 1px dashed rgba(119,181,254,0.24); }
p { margin: 4px 0; }
span { font-weight: bold; color: #77b5fe; }
form { margin-top: 10px; padding: 8px 5px; border: none; border-radius: 0; background-color: transparent; width: 100%; }
form label { display: block; margin-bottom: 3px; font-weight: bold; }
form input[type='text'], form input[type='password'], form input[type='number'], form input[type='file'] {
    width: 100%; padding: 6px; margin-bottom: 6px; border: 1px solid #888; border-radius: 3px; box-sizing: border-box; background: #222; color: #fff;
}
form button[type='submit'], form button[type='button'] {
    background-color: #28a745; color: white; border: 1px solid #218838; border-radius: 4px; padding: 5px 10px; cursor: pointer; margin: 3px;
    width: auto; display: inline-block; font-size: 0.85em;
}
form button[type='submit']:hover, form button[type='button']:hover { background-color: #218838; }
button, h3 + button {
    background-color: #333; color: white; border: 1px solid #555; border-radius: 4px; padding: 5px 10px; cursor: pointer; margin: 3px;
    width: auto; display: inline-block; font-size: 0.85em;
}
button:hover, h3 + button:hover { background-color: #444; }
#uploadStatus { margin-top: 10px; font-weight: bold; }
.info-text { background-color: rgba(62,194,247,0.3); border-left: 3px solid #77b5fe; padding: 6px; margin: 5px 0; font-size: 0.85em; color: #fff; }
form p { margin-top: 3px; margin-bottom: 8px; font-size: 0.9em; }
.history-table-container { overflow-x: auto; margin: 8px 0; width: 100%; }
.history-selector { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.history-selector label { font-weight: bold; font-size: 0.9em; color: #aab; }
.history-selector select { padding: 8px 32px 8px 12px; border-radius: 8px; border: 2px solid #444; background: linear-gradient(180deg, #1e1e3a, #141428); color: #77b5fe; font-size: 0.95em; font-weight: bold; min-width: 180px; cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2377b5fe' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; transition: border-color 0.2s, box-shadow 0.2s; -webkit-tap-highlight-color: rgba(119,181,254,0.2); }
.history-selector select:hover { border-color: #77b5fe; background: linear-gradient(180deg, #252545, #1a1a30); }
.history-selector select:focus { border-color: #77b5fe; outline: none; box-shadow: 0 0 8px rgba(119,181,254,0.3); }
.history-selector select option { background: #1a1a2e; color: #ccc; padding: 8px; font-size: 0.95em; }
.history-selector select option:checked { background: #007bff; color: #fff; }
.custom-select-wrap { position: relative; display: inline-block; min-width: 180px; width: 100%; }
.custom-select-wrap select { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; z-index: 0; border: none; background: transparent; }
.custom-select-trigger { display: block; width: 100%; box-sizing: border-box; padding: 8px 32px 8px 12px; border-radius: 8px; border: 2px solid #444; background: linear-gradient(180deg, #1e1e3a, #141428); color: #77b5fe; font-size: 0.95em; font-weight: bold; cursor: pointer; touch-action: manipulation; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2377b5fe' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.custom-select-trigger:hover { border-color: #77b5fe; background: linear-gradient(180deg, #252545, #1a1a30); }
.custom-select-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; margin-top: 2px; max-height: 220px; overflow-y: auto; background: #1a1a2e; border: 2px solid #444; border-radius: 8px; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.custom-select-dropdown.open { display: block; }
.custom-select-option { padding: 10px 12px; color: #ccc; cursor: pointer; font-size: 0.95em; border-bottom: 1px solid #333; }
.custom-select-option:last-child { border-bottom: none; }
.custom-select-option:hover, .custom-select-option.selected { background: #007bff; color: #fff; }
.history-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 10px 0; background: rgba(20,20,35,0.8); color: #fff; border: 1px solid #3a3a5a; border-radius: 8px; table-layout: auto; overflow: hidden; }
.history-table th { background: linear-gradient(180deg, rgba(50,50,80,0.95), rgba(35,35,60,0.95)); color: #77b5fe; padding: 10px 8px; text-align: left; font-weight: bold; font-size: 0.85em; border-bottom: 2px solid #3a3a5a; }
.history-table th:last-child { width: 92px; min-width: 92px; max-width: 92px; text-align: center; }
.history-table td { padding: 8px 8px; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.85em; vertical-align: middle; }
.history-table td:last-child { width: 92px; min-width: 92px; max-width: 92px; padding: 4px 2px; text-align: center; }
.history-table tbody tr { transition: background 0.15s; }
.history-table tbody tr:hover { background-color: rgba(62,194,247,0.12); }
.history-table tbody tr:nth-child(even) { background-color: rgba(255,255,255,0.03); }
.history-summary { background: linear-gradient(135deg, rgba(30,60,40,0.6), rgba(25,50,35,0.6)); border: 1px solid rgba(40,167,69,0.3); padding: 10px 8px; border-radius: 8px; margin-top: 12px; display: flex; flex-direction: row; flex-wrap: nowrap; gap: 8px; align-items: center; justify-content: space-between; width: 100%; max-width: 100%; overflow: hidden; }
.history-summary p { display: block; flex: 1 1 0; min-width: 0; max-width: 100%; margin: 0; padding: 2px 0; font-size: 0.88em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.history-summary p strong, .history-summary p span { display: inline; }
@media (max-width: 600px) {
    .history-summary { gap: 4px; padding: 7px 4px; }
    .history-summary p { flex: 1 1 0; width: auto; max-width: none; font-size: 0.68em; }
}
.current-month { background-color: rgba(119,181,254,0.15) !important; font-weight: bold; }
.edit-input { width: 80px; padding: 6px 8px; border: 1px solid rgba(119,181,254,0.45); border-radius: 8px; font-size: 0.88em; text-align: right; background: linear-gradient(180deg, #252a45, #1a1e32); color: #e8eeff; box-shadow: inset 0 1px 3px rgba(0,0,0,0.25); vertical-align: middle; }
.edit-input:focus { outline: none; border-color: #77b5fe; box-shadow: 0 0 0 2px rgba(119,181,254,0.2), inset 0 1px 3px rgba(0,0,0,0.25); }
.btn-edit { background-color: rgba(255,255,255,0.1); color: white; border: 1px solid #555; padding: 2px 4px; border-radius: 3px; cursor: pointer; font-size: 0.7em; margin-left: 1px; min-width: 22px; max-width: 30px; width: auto; height: 24px; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; transition: background 0.15s; }
.btn-edit:hover { background-color: rgba(255,255,255,0.2); }
.btn-save { background-color: #28a745; border-color: #218838; }
.btn-save:hover { background-color: #218838; }
.btn-cancel { background-color: #6c757d; border-color: #5a6268; }
.btn-cancel:hover { background-color: #5a6268; }
.action-buttons { white-space: nowrap; text-align: center; vertical-align: middle; }
.action-buttons .btn-edit { margin: 0 1px; }
/* Modal de saisie (mobile = même expérience que PC) */
.edit-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.edit-modal-content { background: linear-gradient(180deg, #1e1e3a, #141428); border: 2px solid #77b5fe; border-radius: 12px; padding: 20px; max-width: 320px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
.edit-modal-content h3 { margin: 0 0 16px 0; color: #77b5fe; font-size: 1.1em; }
.edit-modal-body { margin-bottom: 16px; }
.edit-modal-body label { display: block; margin-bottom: 8px; font-weight: bold; color: #ccc; }
.edit-modal-input { width: 100%; padding: 12px 14px; font-size: 1.1em; border: 2px solid #77b5fe; border-radius: 8px; background: #1a1a2e; color: #fff; box-sizing: border-box; }
.edit-modal-input:focus { outline: none; border-color: #a0d0ff; box-shadow: 0 0 8px rgba(119,181,254,0.3); }
.edit-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-modal-save { background: #28a745; color: white; border: 1px solid #218838; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 0.95em; }
.btn-modal-save:hover { background: #218838; }
.btn-modal-cancel { background: #6c757d; color: white; border: 1px solid #5a6268; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 0.95em; }
.btn-modal-cancel:hover { background: #5a6268; }
.graph-controls { display: flex; justify-content: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; width: 100%; }
/* Barre période : ligne de 3 boutons, ligne des listes (mobile + desktop) */
.period-toolbar { display: flex; flex-direction: column; align-items: stretch; width: 100%; max-width: 440px; margin: 0 auto 10px; padding: 6px 7px 7px; border: 1px solid rgba(119,181,254,0.28); border-radius: 10px; background: linear-gradient(165deg, rgba(22,28,48,0.95), rgba(12,14,28,0.88)); box-sizing: border-box; box-shadow: 0 2px 10px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.06); }
.period-buttons-row { display: flex; flex-direction: row; gap: 5px; width: 100%; margin-bottom: 6px; }
.period-btn-cell { flex: 1 1 0; min-width: 0; display: flex; }
.period-fields-row { display: flex; flex-direction: row; gap: 5px; width: 100%; align-items: stretch; }
.period-field-cell { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.graph-btn { background: linear-gradient(180deg, rgba(55,65,95,0.9), rgba(35,40,62,0.95)); color: #f0f4ff; border: 1px solid rgba(119,181,254,0.28); padding: 5px 6px; border-radius: 7px; cursor: pointer; font-size: 0.78em; width: 100%; min-width: 0; min-height: 30px; margin: 0; display: flex; align-items: center; justify-content: center; text-align: center; transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.1s; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.07); line-height: 1.2; }
.graph-btn:hover { background: linear-gradient(180deg, rgba(70,82,118,0.95), rgba(45,52,78,0.98)); color: #fff; border-color: rgba(119,181,254,0.45); }
.graph-btn:active { transform: scale(0.98); }
.graph-btn.active { background: linear-gradient(180deg, #1a6fd4, #0d4a9c); color: #fff; font-weight: bold; border-color: rgba(140,200,255,0.5); box-shadow: 0 2px 8px rgba(26,111,212,0.35), inset 0 1px 0 rgba(255,255,255,0.12); }
.graph-btn.active:hover { background: linear-gradient(180deg, #1c7ae8, #0f5299); }
.graph-selector-under { display: flex; flex-direction: column; gap: 0; margin-top: 0; width: 100%; flex: 1 1 auto; }
.graph-selector-under .custom-select-wrap { min-width: 0; width: 100%; }
.graph-selector-under .custom-select-trigger { min-height: 30px; display: flex; align-items: center; padding: 5px 26px 5px 8px; border-radius: 7px; border: 1px solid rgba(119,181,254,0.32); color: #c8dcff; font-size: 0.76em; font-weight: 600; box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); background-color: #181c32; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2377b5fe' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"), linear-gradient(180deg, #2a3150, #181c32); background-repeat: no-repeat, no-repeat; background-position: right 7px center, 0 0; }
.graph-selector-under .custom-select-trigger:hover { border-color: rgba(119,181,254,0.5); color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a8d4ff' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"), linear-gradient(180deg, #323a5c, #222640); }
.graph-selector-under select { width: 100% !important; min-width: 0 !important; min-height: 30px; padding: 5px 26px 5px 8px; border-radius: 7px; border: 1px solid rgba(119,181,254,0.32); color: #c8dcff; font-size: 0.76em; font-weight: 600; cursor: pointer; appearance: none; -webkit-appearance: none; box-sizing: border-box; box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); background-color: #181c32; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2377b5fe' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"), linear-gradient(180deg, #2a3150, #181c32); background-repeat: no-repeat, no-repeat; background-position: right 7px center, 0 0; }
.graph-selector-under select:hover { border-color: rgba(119,181,254,0.5); color: #fff; }
.graph-selector-under select:focus { border-color: #77b5fe; outline: none; box-shadow: 0 0 0 1px rgba(119,181,254,0.3), inset 0 1px 3px rgba(0,0,0,0.2); }
.chart-container { height: 320px; margin: 10px 0; position: relative; width: 100%; background-color: rgba(20, 20, 30, 0.8); border-radius: 8px; padding: 8px; box-sizing: border-box; border: 1px solid #333; }
.chart-container canvas { width: 100% !important; max-width: 100%; }
.history-graph-controls { display: flex; justify-content: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; width: 100%; }
.history-graph-btn { background: linear-gradient(180deg, rgba(55,65,95,0.9), rgba(35,40,62,0.95)); color: #f0f4ff; border: 1px solid rgba(119,181,254,0.28); padding: 5px 4px; border-radius: 7px; cursor: pointer; font-size: 0.72em; width: 100%; min-width: 0; min-height: 30px; margin: 0; display: flex; align-items: center; justify-content: center; text-align: center; transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.1s; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.07); line-height: 1.15; }
.history-graph-btn:hover { background: linear-gradient(180deg, rgba(70,82,118,0.95), rgba(45,52,78,0.98)); color: #fff; border-color: rgba(119,181,254,0.45); }
.history-graph-btn:active { transform: scale(0.98); }
.history-graph-btn.active { background: linear-gradient(180deg, #1a6fd4, #0d4a9c); color: #fff; font-weight: bold; border-color: rgba(140,200,255,0.5); box-shadow: 0 2px 8px rgba(26,111,212,0.35), inset 0 1px 0 rgba(255,255,255,0.12); }
.history-graph-btn.active:hover { background: linear-gradient(180deg, #1c7ae8, #0f5299); }
.history-selector-under { display: flex; flex-direction: column; gap: 0; margin-top: 0; width: 100%; flex: 1 1 auto; }
.history-selector-under .custom-select-wrap { min-width: 0; width: 100%; }
.history-selector-under .custom-select-trigger { min-height: 30px; display: flex; align-items: center; padding: 5px 26px 5px 8px; border-radius: 7px; border: 1px solid rgba(119,181,254,0.32); color: #c8dcff; font-size: 0.76em; font-weight: 600; box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); background-color: #181c32; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2377b5fe' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"), linear-gradient(180deg, #2a3150, #181c32); background-repeat: no-repeat, no-repeat; background-position: right 7px center, 0 0; }
.history-selector-under .custom-select-trigger:hover { border-color: rgba(119,181,254,0.5); color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a8d4ff' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"), linear-gradient(180deg, #323a5c, #222640); }
.history-selector-under select { width: 100% !important; min-width: 0 !important; min-height: 30px; padding: 5px 26px 5px 8px; border-radius: 7px; border: 1px solid rgba(119,181,254,0.32); color: #c8dcff; font-size: 0.76em; font-weight: 600; cursor: pointer; appearance: none; -webkit-appearance: none; box-sizing: border-box; box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); background-color: #181c32; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2377b5fe' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"), linear-gradient(180deg, #2a3150, #181c32); background-repeat: no-repeat, no-repeat; background-position: right 7px center, 0 0; }
.history-selector-under select:hover { border-color: rgba(119,181,254,0.5); color: #fff; }
.history-selector-under select:focus { border-color: #77b5fe; outline: none; box-shadow: 0 0 0 1px rgba(119,181,254,0.3), inset 0 1px 3px rgba(0,0,0,0.2); }
.param-select-wrap { display: inline-block; min-width: 140px; flex: 1 1 150px; }
.param-select-wrap select { width: 100% !important; min-width: 0 !important; padding: 8px 32px 8px 12px; border-radius: 8px; border: 2px solid #444; background: linear-gradient(180deg, #1e1e3a, #141428); color: #77b5fe; font-size: 0.95em; font-weight: bold; cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2377b5fe' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; box-sizing: border-box; }
.param-select-wrap select:hover { border-color: #77b5fe; }
.param-select-wrap select:focus { border-color: #77b5fe; outline: none; box-shadow: 0 0 8px rgba(119,181,254,0.3); }
.history-daily-table-container { margin-top: 8px; width: 100%; overflow-x: auto; }
.history-daily-table-container h3 { color: #77b5fe; margin-bottom: 8px; font-size: 1em; }
.backup-section { background-color: rgba(40,40,60,0.5); border: 1px solid #77b5fe; padding: 8px; border-radius: 4px; margin-top: 8px; width: auto; max-width: 100%; display: inline-block; }
.backup-section button { margin: 3px 0; width: auto; display: inline-block; }
/* Page Paramètres - Sections repliables */
#settings-section { padding: 5px 3px; margin-top: 8px; width: 100%; }
#settings-section h2 { margin: 0 0 8px 0; font-size: 1.1em; text-align: center; }
.settings-group { margin: 8px 0; border: 1px solid #444; border-radius: 8px; background: rgba(25,25,45,0.7); overflow: hidden; }
.settings-group summary { padding: 10px 12px; cursor: pointer; font-weight: bold; font-size: 0.95em; background: rgba(40,40,70,0.8); color: #77b5fe; list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; border-bottom: 1px solid transparent; }
.settings-group[open] summary { border-bottom: 1px solid #555; }
.settings-group summary::-webkit-details-marker { display: none; }
.settings-group summary::after { content: '▶'; font-size: 0.65em; margin-left: auto; transition: transform 0.2s; }
.settings-group[open] summary::after { transform: rotate(90deg); }
.settings-group summary:hover { background: rgba(50,50,90,0.9); }
.group-content { padding: 8px 10px; }
.group-content form { margin: 0; padding: 0; }
.group-content h4 { margin: 12px 0 4px 0; font-size: 0.85em; color: #aaa; border-bottom: 1px solid #444; padding-bottom: 3px; }
.group-content h4:first-child { margin-top: 2px; }
/* Layout compact : champs côte à côte avec bouton intégré */
.form-row { display: flex; align-items: center; gap: 5px; margin: 4px 0; flex-wrap: wrap; }
.form-row label { flex: 0 0 auto; margin: 0; font-size: 0.82em; font-weight: bold; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
/* Champs compacts : largeur fixe courte au lieu de flex élastique */
.form-row input[type='text'], .form-row input[type='password'] { flex: 0 0 160px; min-width: 100px; max-width: 200px; padding: 4px 6px; border: 1px solid #666; border-radius: 4px; background: #1a1a2e; color: #fff; font-size: 0.82em; box-sizing: border-box; margin: 0; appearance: auto; }
.form-row input[type='number'] { flex: 0 0 80px; min-width: 60px; max-width: 100px; padding: 4px 6px; border: 1px solid #666; border-radius: 4px; background: #1a1a2e; color: #fff; font-size: 0.82em; box-sizing: border-box; margin: 0; appearance: auto; }
.form-row input.pin-input { flex: 0 0 42px; min-width: 36px; max-width: 50px; padding: 3px 2px; text-align: center; }
.form-row label.pin-lbl { flex: 0 0 auto; max-width: 40px; font-size: 0.78em; }
.form-row select { flex: 0 0 130px; min-width: 90px; max-width: 160px; padding: 4px 6px; border: 1px solid #666; border-radius: 4px; background: #1a1a2e; color: #fff; font-size: 0.82em; box-sizing: border-box; margin: 0; appearance: auto; }
.form-row input[type='file'] { flex: 0 0 auto; min-width: 0; max-width: 220px; padding: 4px 6px; font-size: 0.8em; color: #ccc; }
.form-row input:focus, .form-row select:focus { border-color: #77b5fe; outline: none; }
.form-row input[type='checkbox'] { accent-color: #28a745; width: 16px; height: 16px; cursor: pointer; flex: 0 0 auto; }
/* Bouton compact à côté du champ dans la même ligne */
.form-row button { flex: 0 0 auto; padding: 4px 10px; font-size: 0.78em; margin: 0; background-color: #28a745; color: white; border: 1px solid #218838; border-radius: 4px; cursor: pointer; white-space: nowrap; min-width: 0; }
.form-row button:hover { background-color: #218838; }
.form-action { margin: 6px 0 2px; display: flex; flex-wrap: wrap; gap: 6px; }
.form-action button { padding: 5px 12px; font-size: 0.8em; background-color: #28a745; color: white; border: 1px solid #218838; border-radius: 4px; cursor: pointer; width: auto; display: inline-block; }
.form-action button:hover { background-color: #218838; }
.btn-watchdog { padding: 4px 10px; font-size: 0.82em; background: #333; color: #ccc; border: 1px solid #555; border-radius: 4px; cursor: pointer; transition: background .2s, border-color .2s; }
.btn-watchdog:hover { background: #444; border-color: #777; }
.btn-watchdog.active { background: #1565c0; color: #fff; border-color: #1976d2; }
/* current-val : inline dans la form-row, à côté du champ et du bouton */
.current-val { font-size: 0.76em; color: #888; margin: 0; padding: 0 2px; flex: 0 0 auto; white-space: nowrap; display: inline; }
.current-val span { color: #77b5fe; font-weight: bold; }
/* current-val quand il reste seul sur sa ligne (hors form-row) */
.form-row .current-val { display: inline; }
/* Visibilité des pages Historique / Graphiques dans Paramètres > Interface. */
.page-visibility-row { flex-wrap: nowrap; }
.page-visibility-row label { min-width: 150px; }
@media (max-width: 480px) {
    .page-visibility-row { display: grid; grid-template-columns: minmax(0,1fr) 20px auto; gap: 7px; width: 100%; }
    .page-visibility-row label { min-width: 0; max-width: none; }
}

/* Tarifs : présentation stable sur mobile (un champ par ligne). */
.tariff-row { flex-wrap: nowrap; }
.tariff-row label { min-width: 0; }
.tariff-row input[type='number'], .tariff-row select { flex: 0 0 100px; }
.tariff-action-row { justify-content: flex-end; }
@media (max-width: 480px) {
    .tariff-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px; align-items: center; gap: 7px; width: 100%; }
    .tariff-row label { max-width: none; overflow: visible; text-overflow: clip; }
    .tariff-row input[type='number'], .tariff-row select { width: 100%; min-width: 0; max-width: none; flex: none; }
    .tariff-action-row { display: flex; justify-content: flex-end; }
}

.settings-group .info-text { padding: 5px 8px; margin: 4px 0; font-size: 0.82em; }
.settings-group .backup-section { padding: 8px; margin-top: 6px; font-size: 0.85em; width: 100%; max-width: 100%; box-sizing: border-box; display: block; }
.settings-group .backup-section p { margin: 3px 0; }
.settings-group .backup-section button { width: auto; display: inline-block; margin: 3px 3px; }
.restore-scope { margin-top: 8px; padding: 8px; background: rgba(30,30,50,0.6); border: 1px solid #555; border-radius: 6px; }
.restore-scope-title { font-size: 0.82em; color: #aaa; display: block; margin-bottom: 6px; }
.restore-checkboxes { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.restore-cb { display: flex; align-items: center; gap: 4px; font-size: 0.85em; color: #ccc; cursor: pointer; padding: 3px 0; }
.restore-cb input[type='checkbox'] { accent-color: #28a745; width: 16px; height: 16px; cursor: pointer; }
.btn-restore-all { padding: 2px 8px; font-size: 0.75em; background: rgba(255,255,255,0.1); color: #ccc; border: 1px solid #555; border-radius: 3px; cursor: pointer; }
.btn-restore-all:hover { background: rgba(255,255,255,0.2); color: #fff; }
/* === Sauvegarde & Restauration : 2 secteurs (maquette v5) === */
.save-restore-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.sav-sector { background: rgba(30,80,50,0.25); border: 1px solid rgba(76,175,80,0.4); border-radius: 8px; padding: 10px; }
.rst-sector { background: rgba(80,60,20,0.25); border: 1px solid rgba(255,193,7,0.4); border-radius: 8px; padding: 10px; }
.sav-sector h4, .rst-sector h4 { margin: 0 0 8px 0; padding-bottom: 5px; font-size: 0.9em; border-bottom: 1px solid #444; }
.sav-sector h4 { color: #66bb6a; border-color: rgba(76,175,80,0.3); }
.rst-sector h4 { color: #ffca28; border-color: rgba(255,193,7,0.3); }
.sav-item, .rst-item { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sav-item:last-child, .rst-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.sav-item-label, .rst-item-label { font-size: 0.82em; color: #aaa; margin-bottom: 4px; display: block; }
.sav-item-desc, .rst-item-desc { font-size: 0.75em; color: #777; margin-top: 3px; }
.input-with-btn { display: flex; gap: 4px; align-items: center; }
.input-with-btn button { flex: 1; white-space: nowrap; }
.param-select-narrow { flex: 0 0 auto; min-width: 0; padding: 8px 26px 8px 10px; border-radius: 8px; border: 2px solid #444; background: linear-gradient(180deg, #1e1e3a, #141428); color: #77b5fe; font-size: 0.9em; font-weight: bold; cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2377b5fe' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; box-sizing: border-box; }
.param-select-narrow:hover { border-color: #77b5fe; }
.param-select-narrow:focus { border-color: #77b5fe; outline: none; box-shadow: 0 0 8px rgba(119,181,254,0.3); }
.param-select-narrow[id$='Year'] { width: 80px; }
.param-select-narrow[id$='Month'] { width: 100px; }
/* === Carte SD : liste fichiers + archives === */
.sd-file-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.sd-file-row:last-child { border-bottom: none; }
.sd-file-name { color: #ccc; }
.sd-file-size { color: #777; font-size: 0.9em; }
.sd-archive-group { margin-top: 0; padding-top: 0; }
.sd-archive-header { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.04); color: #ccc; font-size: 0.82em; }
.sd-archive-header:last-child { border-bottom: none; }
.sd-archive-total { color: #777; font-size: 0.9em; }
/* OTA Web (compact) */
.ota-panel { border: 1px solid #555; border-radius: 6px; padding: 8px 10px; margin: 8px 0; font-size: 0.85em; box-sizing: border-box; }
.ota-panel h4 { margin: 0 0 4px; font-size: 1em; color: #77b5fe; }
.ota-ver { margin: 0 0 8px; color: #aaa; }
.ota-ver strong { color: #7dffb3; }
.ota-upload-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0; }
.ota-upload-form input[type="file"] { max-width: 100%; color: #ccc; font-size: 0.9em; }
.btn-ota-update { padding: 5px 12px; font-size: 0.85em; background: #28a745; color: #fff; border: 1px solid #218838; border-radius: 4px; cursor: pointer; }
.btn-ota-update:hover { background: #218838; }
.btn-ota-update:disabled { opacity: 0.5; cursor: not-allowed; }
.ota-progress-wrap { max-width: 400px; margin: 6px 0; }
.ota-progress-label { font-size: 0.82em; color: #77b5fe; margin-bottom: 2px; text-align: center; }
.ota-progress-track { height: 14px; background: #1a1a28; border-radius: 3px; overflow: hidden; border: 1px solid #444; }
.ota-progress-bar { height: 100%; width: 0%; background: #2a8f5a; transition: width 0.1s; }
.ota-status { text-align: center; font-weight: bold; min-height: 1.1em; margin: 4px 0; font-size: 0.85em; color: #9cf; }
.ota-github-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin:7px 0; }
.ota-github-actions button { padding:6px 12px; border-radius:4px; border:1px solid #555; cursor:pointer; }
.ota-github-actions button:disabled { opacity:.5; cursor:not-allowed; }
.ota-panel code { color:#f0c674; font-size:.92em; }
.settings-group.danger { border-color: rgba(198,40,40,0.6); }
.settings-group.danger summary { background: rgba(80,20,20,0.7); color: #ff8a80; }
.settings-group.danger summary:hover { background: rgba(100,25,25,0.8); }
.raz-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.raz-buttons button { flex: 0 0 auto; padding: 6px 12px; font-size: 0.82em; width: auto; }
.raz-buttons .btn-danger { background: #c62828; border-color: #e53935; }
.raz-buttons .btn-danger:hover { background: #b71c1c; }
a:link { color: #aaf; text-decoration: none; }
a:visited { color: #ccf; text-decoration: none; }
.status-box { padding: 12px 14px; border-radius: 8px; border: 1px solid; color: #ffffff; box-sizing: border-box; }
.status-box-mesures { background-color: rgba(30, 50, 80, 0.85); border-color: rgba(54, 162, 235, 0.5); }
.realtime-content { display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: nowrap; }
.realtime-text { flex: 1; min-width: 0; text-align: left; }
.water-meter { width: 172px; height: 172px; flex: 0 0 172px; --meter-spin: 1.80s; }
.water-meter-svg { width: 100%; height: 100%; overflow: visible; }
.meter-face { fill: url(#meterFaceGradient); stroke: rgba(129,212,250,0.55); stroke-width: 2.4; }
.meter-ring-bg { fill: none; stroke: rgba(255,255,255,0.12); stroke-width: 10; }
.meter-ring { fill: none; stroke: url(#meterRingGradient); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transform: rotate(-90deg); transform-origin: 80px 80px; transition: stroke-dashoffset 0.28s ease, filter 0.20s ease; }
.meter-caption { fill: #9ecff4; font-size: 10px; font-weight: bold; letter-spacing: 2px; text-anchor: middle; }
.meter-turbine { transform-box: view-box; transform-origin: 80px 67px; }
.meter-blade { fill: rgba(79,195,247,0.88); stroke: #81D4FA; stroke-width: 1.2; }
.meter-hub { fill: #d5f3ff; stroke: #29B6F6; stroke-width: 2.2; }
.meter-value { fill: #ffffff; font-size: 24px; font-weight: bold; text-anchor: middle; }
.meter-unit { fill: #81D4FA; font-size: 12px; font-weight: bold; text-anchor: middle; }
.water-meter.flowing .meter-turbine { animation: meterSpin var(--meter-spin) linear infinite; }
.water-meter.flowing .meter-ring { filter: drop-shadow(0 0 7px rgba(41,182,246,0.95)); }
.water-meter.flowing .meter-face { stroke: rgba(129,212,250,0.85); }
@keyframes meterSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.status-box-consommation { background-color: rgba(30, 60, 60, 0.85); border-color: rgba(75, 192, 192, 0.5); }
.status-box-statistiques { background-color: rgba(80, 60, 30, 0.85); border-color: rgba(255, 206, 86, 0.5); }
.stats-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.stats-tab-btn { flex: 1; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,206,86,0.25); border-radius: 6px; padding: 5px 8px; color: #ccc; font-size: 0.85em; font-weight: 500; cursor: pointer; transition: background 0.2s, color 0.2s; }
.stats-tab-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.stats-tab-btn.active { background: rgba(255,206,86,0.3); color: #fff; font-weight: bold; border-color: rgba(255,206,86,0.6); }
.stats-tab-content { }
.status-box-reseau { background-color: rgba(50, 30, 80, 0.85); border-color: rgba(153, 102, 255, 0.5); }
.status-box h3 { margin-top: 0; margin-bottom: 8px; font-size: 0.95em; color: #ffffff; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px; }
.status-box p { margin: 4px 0; font-size: 0.9em; color: #ddd; }
.status-box span { color: #77b5fe; font-weight: bold; }
.status-box .status-consumption-line { margin: 5px 0; white-space: nowrap; font-size: clamp(0.68em, 2.7vw, 0.82em); letter-spacing: -0.05px; }
.status-box .status-total-line { margin: 3px 0; white-space: nowrap; font-size: clamp(0.68em, 2.7vw, 0.82em); font-weight: bold; letter-spacing: -0.05px; }
/* Tablette et mobile */
@media (max-width: 768px) {
    body { padding: 5px 3px; }
    .container { padding: 8px 6px; border: none; border-radius: 0; }
    h1 { font-size: 1.3em; margin: 3px 0; }
    h2 { font-size: 1.1em; margin: 4px 0; }
    .onglets { max-width: 100%; gap: 4px; }
    .Bonglet { padding: 6px 4px; min-height: 32px; font-size: 0.85em; }
    .status-grid { grid-template-columns: 1fr; gap: 6px; }
    .status-box { padding: 8px 10px; }
    .water-meter { width: 142px; height: 142px; flex-basis: 142px; }
    .status-box h3 { font-size: 0.9em; }
    .status-box p { font-size: 0.85em; margin: 2px 0; }
    .chart-container { height: 220px; margin: 6px 0; }
    .history-table th, .history-table td { padding: 6px 4px; font-size: 0.8em; }
    /* Résultats de l'Historique : rester sur une seule ligne sur mobile. */
    .history-summary { flex-direction: row; flex-wrap: nowrap; gap: 3px; padding: 6px 3px; }
    .history-summary p { flex: 1 1 0; min-width: 0; width: auto; max-width: none; font-size: 0.68em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    form { padding: 5px 3px; }
    button { padding: 5px 8px; font-size: 0.85em; }
    .period-toolbar { max-width: 100%; margin-bottom: 8px; padding: 5px 5px 6px; }
    .period-buttons-row { gap: 4px; margin-bottom: 5px; }
    .period-fields-row { gap: 4px; }
    .graph-btn { font-size: 0.74em; min-height: 28px; padding: 4px 4px; }
    .history-graph-btn { font-size: 0.68em; min-height: 28px; padding: 4px 2px; }
    .graph-selector-under select, .graph-selector-under .custom-select-trigger,
    .history-selector-under select, .history-selector-under .custom-select-trigger { min-height: 28px; font-size: 0.72em; padding: 4px 22px 4px 6px; }
    .btn-edit { padding: 3px 5px; font-size: 0.75em; margin: 0 1px; min-width: 22px; max-width: 28px; height: 24px; }
    .history-table th:last-child, .history-table td:last-child { width: 84px; min-width: 84px; max-width: 84px; }
    .settings-group { margin: 5px 0; }
    /* === FIX page Paramètres sur tablette/mobile === */
    /* Fix #1 : empile les 2 secteurs (Téléchargement / Restauration) */
    .save-restore-grid { grid-template-columns: 1fr; gap: 12px; }
    .sav-sector, .rst-sector { padding: 8px; }
    /* Fix #2 : libère de la place dans form-row des broches SD */
    .form-row input.pin-input { flex: 0 0 44px; min-width: 36px; max-width: 56px; }
    .form-row label.pin-lbl { font-size: 0.72em; max-width: 34px; }
    /* Fix #3 : checkboxes de restauration empilent proprement */
    .restore-checkboxes { gap: 5px 10px; }
    .restore-cb { font-size: 0.8em; }
    /* Fix #4 : inputs Année/Mois + bouton respirent */
    .input-with-btn input[id$='Year'], .input-with-btn select[id$='Year'] { flex: 0 0 auto; min-width: 56px; max-width: 80px; padding: 4px 5px; font-size: 0.8em; }
    .input-with-btn input[id$='Month'], .input-with-btn select[id$='Month'] { flex: 0 0 auto; min-width: 48px; max-width: 64px; padding: 4px 5px; font-size: 0.8em; }
    .input-with-btn button { padding: 4px 8px; font-size: 0.74em; }
    .input-with-btn { flex-wrap: nowrap; }
    /* Fix #5 : details propres sur iOS Safari (tap highlight) */
    .settings-group { -webkit-tap-highlight-color: transparent; }
    .settings-group summary { -webkit-touch-callout: none; }
    /* Inputs pin de calibration (id^=pin) */
    .form-row input[id^='pin'] { flex: 0 0 44px; min-width: 36px; max-width: 56px; }
}
/* Petit mobile */
@media (max-width: 480px) {
    .water-meter { width: 124px; height: 124px; flex-basis: 124px; }
    body { padding: 3px 2px; }
    .container { padding: 4px 3px; }
    h1 { font-size: 1.1em; }
    h2 { font-size: 1em; }
    .Bonglet { padding: 5px 3px; min-height: 30px; font-size: 0.78em; }
    .chart-container { height: 180px; }
    .history-table th, .history-table td { padding: 4px 6px; font-size: 0.8em; }
    .btn-edit { padding: 3px 4px; font-size: 0.72em; margin: 0 1px; min-width: 21px; max-width: 26px; height: 23px; }
    .period-toolbar { padding: 4px; }
    .period-buttons-row, .period-fields-row { gap: 3px; }
    .graph-btn { font-size: 0.7em; min-height: 26px; }
    .history-graph-btn { padding: 3px 2px; font-size: 0.62em; min-height: 26px; line-height: 1.1; }
    .graph-selector-under select, .graph-selector-under .custom-select-trigger,
    .history-selector-under select, .history-selector-under .custom-select-trigger { min-height: 26px; font-size: 0.68em; padding: 3px 20px 3px 5px; }
    .history-table th:last-child, .history-table td:last-child { width: 78px; min-width: 78px; max-width: 78px; }
    .form-row { flex-wrap: wrap; }
    .form-row label { flex: 0 0 100%; }
    .current-val { margin-left: 0; }
    /* === FIX page Paramètres sur très petit mobile (≤ 480px) === */
    .save-restore-grid { gap: 10px; }
    .sav-sector h4, .rst-sector h4 { font-size: 0.84em; }
    .sav-sector, .rst-sector { padding: 6px 8px; }
    .input-with-btn input[id$='Year'], .input-with-btn select[id$='Year'] { max-width: 72px; font-size: 0.74em; }
    .input-with-btn input[id$='Month'], .input-with-btn select[id$='Month'] { max-width: 56px; font-size: 0.74em; }
    .input-with-btn button { font-size: 0.7em; padding: 4px 6px; }
    .form-row input.pin-input { flex: 0 0 40px; min-width: 32px; max-width: 48px; }
    .form-row label.pin-lbl { font-size: 0.68em; max-width: 30px; }
    .restore-cb { font-size: 0.75em; gap: 3px; }
    .form-row select { flex: 1 1 110px; min-width: 80px; max-width: 100%; }
    .form-row input[type='text'], .form-row input[type='password'] { flex: 1 1 110px; min-width: 80px; max-width: 100%; }
}
@media (max-width: 360px) {
    .onglets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .Bonglet { min-height: 30px; font-size: 0.8em; }
    /* === FIX page Paramètres sur très petit mobile (≤ 360px) === */
    .input-with-btn input[id$='Year'], .input-with-btn select[id$='Year'] { max-width: 64px; min-width: 48px; }
    .input-with-btn input[id$='Month'], .input-with-btn select[id$='Month'] { max-width: 50px; min-width: 42px; }
    .input-with-btn button { font-size: 0.66em; padding: 3px 5px; }
    .form-row input.pin-input { flex: 0 0 36px; min-width: 30px; max-width: 44px; }
    .form-row label.pin-lbl { font-size: 0.62em; max-width: 26px; }
    .restore-cb { font-size: 0.7em; }
}
