/* ============================================================
   common-data.css — Styles partagés pour les pages données
   (MSP1, N3PP, Dashboard, Tide stats, Aquaponie)
   ============================================================ */

/* ----- SECTION HEADER ----- */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #008B74;
}
.section-header i { color: #008B74; font-size: 1.2em; }
.section-header h3 { margin: 0; color: #2c3e50; font-size: 1.15em; }

/* ----- Titres de section décoratifs (fiche 05) — scroll-reveal .sr-visible ----- */
.section-title-decorative {
    text-align: center;
    padding: 30px 0;
    position: relative;
}
.section-title-decorative h2 {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
    color: var(--text-primary, #2c3e50);
}
.section-title-decorative span {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    z-index: 1;
    font-weight: 700;
    font-size: 2.5rem;
    text-transform: uppercase;
    line-height: 0;
    opacity: 0;
    transform: scale(0.98);
    color: var(--border-light, #eef0f2);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.section-title-decorative.sr-visible span {
    opacity: 0.5;
    transform: scale(1.02);
}
.section-title-decorative p {
    margin-bottom: 0;
    position: relative;
    z-index: 2;
    color: var(--text-secondary, #6b7280);
}
@media (prefers-reduced-motion: reduce) {
    .section-title-decorative span { transition: none; }
}

/* ----- Blobs décoratifs en arrière-plan de sections (fiche 06) ----- */
.section-with-blob {
    position: relative;
    overflow: hidden;
}
.section-with-blob.blob-top-right::before {
    content: "";
    position: absolute;
    top: -80px;
    right: -80px;
    width: 350px;
    height: 350px;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    background: rgba(0, 139, 116, 0.06);
    z-index: 0;
}
.section-with-blob.blob-bottom-left::before {
    content: "";
    position: absolute;
    bottom: -100px;
    left: -80px;
    width: 300px;
    height: 300px;
    border-radius: 40% 60% 70% 30% / 30% 70% 60% 40%;
    background: rgba(0, 139, 116, 0.05);
    z-index: 0;
}
.section-with-blob > * {
    position: relative;
    z-index: 1;
}
[data-theme="dark"] .section-with-blob.blob-top-right::before {
    background: rgba(45, 212, 191, 0.06);
}
[data-theme="dark"] .section-with-blob.blob-bottom-left::before {
    background: rgba(45, 212, 191, 0.05);
}

/* ----- Section fond motif pointillé (fiche 07) ----- */
.section-bg-motif {
    background-color: var(--bg-secondary, #f8f9fa);
    background-image: radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.03) 1px, transparent 0);
    background-size: 24px 24px;
    background-position: 0 0;
}
[data-theme="dark"] .section-bg-motif {
    background-color: var(--bg-secondary);
    background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.03) 1px, transparent 0);
}

/* Hero : défini dans realtime-styles.css (style unifié aquaponie/MSP/N3PP) */

/* ----- STATS GRID (stat-cards) ----- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow-card, 0 2px 10px rgba(0,0,0,0.06));
    border-left: 5px solid #bbb;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover, 0 6px 18px rgba(0,139,116,0.15));
}

.stat-card-icon { font-size: 1.5em; margin-bottom: 6px; color: var(--text-secondary, #6b7280); }
.stat-card-label { font-size: 0.9em; color: var(--text-secondary, #6b7280); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.stat-card-value { font-size: 1.6em; font-weight: 700; color: #2c3e50; }
.stat-card-unit { font-size: 0.55em; font-weight: 500; color: var(--text-secondary, #6b7280); }
.stat-card-secondary { font-size: 0.78em; color: var(--text-muted, #6b7280); margin-top: 6px; }

/* Variantes couleur */
.stat-card.temp { border-left-color: #e74c3c; }
.stat-card.temp .stat-card-icon { color: #e74c3c; }

.stat-card.humidity { border-left-color: #3498db; }
.stat-card.humidity .stat-card-icon { color: #3498db; }

.stat-card.light { border-left-color: #f39c12; }
.stat-card.light .stat-card-icon { color: #f39c12; }

.stat-card.water { border-left-color: #008B74; }
.stat-card.water .stat-card-icon { color: #008B74; }

.stat-card.rain { border-left-color: #9b59b6; }
.stat-card.rain .stat-card-icon { color: #9b59b6; }

.stat-card.pump { border-left-color: #008B74; background: linear-gradient(180deg, #fff 0%, #f0faf8 100%); }
.stat-card.pump .stat-card-icon { color: #008B74; }

.stat-card.system { border-left-color: var(--text-secondary, #6b7280); }
.stat-card.system .stat-card-icon { color: var(--text-secondary, #6b7280); }

/* Barre de progression dans stat-card */
.progress-bar-container {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-bar {
    height: 100%;
    border-radius: 3px;
    background: #008B74;
    transition: width 0.6s ease-out;
}

/* ----- CHART CONTAINER ----- */
.chart-container {
    background: rgba(255,255,255,0.95);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card, 0 2px 10px rgba(0,0,0,0.06));
}
.chart-container-title,
.chart-title {
    margin: 0 0 12px;
    font-size: 1em;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-container-title i,
.chart-title i { color: #008B74; }
.chart-title { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid #f0f0f0; }
.chart-legend {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid rgba(0,139,116,0.15);
    font-size: 0.82em;
    color: var(--text-secondary, #6b7280);
    line-height: 1.4;
}

/* Légende avec pastilles de couleur (comme aquaponie) */
.chart-legend-items {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid rgba(0,139,116,0.15);
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
    font-size: 0.82em;
    color: var(--text-secondary, #6b7280);
    line-height: 1.4;
}
.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.chart-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ----- GOOGLE SHEETS CHARTS (mesures manuelles) — visible 100 % quel que soit l'affichage ----- */
/* Conteneur responsive : proportion 4:3 pour les graphiques Google Sheets */
.chemistry-chart-container,
.msp-sheet-card-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    min-height: 240px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
/* Fallback sans aspect-ratio (navigateurs anciens) */
@supports not (aspect-ratio: 4 / 3) {
    .chemistry-chart-container::before,
    .msp-sheet-card-container::before {
        content: "";
        display: block;
        padding-bottom: 75%; /* 3/4 = 4:3 */
    }
    .chemistry-chart-container,
    .msp-sheet-card-container {
        min-height: 0;
    }
}
.chemistry-chart-container iframe,
.msp-sheet-card-container iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 240px;
    border: none;
}
@supports not (aspect-ratio: 4 / 3) {
    .chemistry-chart-container iframe,
    .msp-sheet-card-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
}
/* Grille et cartes (aquaponie) */
.chemistry-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 1.5rem;
    margin: 1rem 0;
}
/* Section chimie : 4 blocs 2x2, référence MSP (Mesures manuelles) */
.chemistry-section-block,
.alt-chemistry-section {
    margin: 1.5rem 0;
}
.chemistry-blocks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 1rem 0;
}
@media (max-width: 768px) {
    .chemistry-blocks-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
/* Bannière de présentation au-dessus des blocs (comme MSP) */
.chemistry-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #008B74;
}
.chemistry-info-icon { font-size: 1.5em; color: #008B74; flex-shrink: 0; }
.chemistry-info-content { flex: 1; min-width: 0; }
.chemistry-info-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1em;
}
.chemistry-info-title i { color: #008B74; }
.chemistry-info-text {
    font-size: 0.9em;
    color: var(--text-secondary, #6b7280);
    line-height: 1.5;
}
/* En-têtes des cartes chimie (aligné msp-sheet-card) */
.chemistry-chart-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid rgba(0, 139, 116, 0.15);
}
.chemistry-chart-icon { color: #008B74; }
.chemistry-chart-title { margin: 0; font-size: 1.1em; font-weight: 600; color: #2c3e50; }
/* Légende dans bloc 4 */
.chemistry-legend { padding: 0; }
.chemistry-legend-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1em;
}
.chemistry-legend-title i { color: #008B74; }
.chemistry-legend-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chemistry-legend-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.88em;
}
.chemistry-legend-icon { color: #008B74; flex-shrink: 0; margin-top: 2px; }
.chemistry-legend-label { font-weight: 600; color: #2c3e50; }
.chemistry-legend-value { color: var(--text-secondary, #6b7280); line-height: 1.4; }
.chemistry-chart-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: var(--shadow-card, 0 2px 10px rgba(0, 0, 0, 0.06));
    overflow: hidden;
}
/* Suivi paramètres chimiques : structure MSP (titre + texte présentation au-dessus, 4 blocs 2x2) */
.chemistry-section,
.alt-chemistry-section { margin: 1.5rem 0; }
.chemistry-section .section-header,
.alt-chemistry-section .section-header { margin-bottom: 1rem; }
.chemistry-info-banner {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 139, 116, 0.06);
    border-radius: 12px;
    border-left: 4px solid #008B74;
}
.chemistry-info-icon { font-size: 1.5em; color: #008B74; flex-shrink: 0; }
.chemistry-info-content { flex: 1; min-width: 0; }
.chemistry-info-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chemistry-info-title i { color: #008B74; }
.chemistry-info-text {
    font-size: 0.9em;
    color: var(--text-secondary, #6b7280);
    line-height: 1.5;
}
.chemistry-blocks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 0;
}
.chemistry-blocks-grid .chemistry-chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.chemistry-blocks-grid .chemistry-chart-header,
.chemistry-chart-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 2px solid rgba(0, 139, 116, 0.15);
}
.chemistry-chart-icon { color: #008B74; font-size: 1.1em; }
.chemistry-chart-title { margin: 0; font-size: 1.05em; font-weight: 600; color: #2c3e50; }
.chemistry-legend-card .chemistry-legend-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px;
}
.chemistry-legend-card .chemistry-legend-title i { color: #008B74; }
.chemistry-legend-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chemistry-legend-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.88em;
}
.chemistry-legend-icon { color: #008B74; flex-shrink: 0; margin-top: 2px; }
.chemistry-legend-label { font-weight: 600; color: #2c3e50; }
.chemistry-legend-value { color: var(--text-secondary, #6b7280); line-height: 1.4; }
@media (max-width: 768px) {
    .chemistry-blocks-grid { grid-template-columns: 1fr; gap: 1rem; }
}
[data-theme="dark"] .chemistry-info-banner { background: var(--accent-muted); border-left-color: var(--accent-primary); }
[data-theme="dark"] .chemistry-info-icon,
[data-theme="dark"] .chemistry-info-title i { color: var(--accent-primary); }
[data-theme="dark"] .chemistry-info-title { color: var(--text-primary); }
[data-theme="dark"] .chemistry-info-text { color: var(--text-secondary); }
[data-theme="dark"] .chemistry-chart-header { border-bottom-color: var(--accent-border); }
[data-theme="dark"] .chemistry-chart-icon { color: var(--accent-primary); }
[data-theme="dark"] .chemistry-chart-title,
[data-theme="dark"] .chemistry-legend-card .chemistry-legend-title { color: var(--text-primary); }
[data-theme="dark"] .chemistry-legend-card .chemistry-legend-title i { color: var(--accent-primary); }
[data-theme="dark"] .chemistry-legend-label { color: var(--text-primary); }
[data-theme="dark"] .chemistry-legend-value { color: var(--text-secondary); }
/* MSP1 mesures manuelles */
.msp-sheets-section { margin: 1.5rem 0; }
.msp-sheets-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}
.msp-sheet-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.msp-sheet-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid rgba(0, 139, 116, 0.15);
}
.msp-sheet-card-header i { color: #008B74; }
.msp-sheet-card-title { margin: 0; font-size: 1.1em; font-weight: 600; color: #2c3e50; }
.msp-sheet-card-container { padding: 1rem; }
/* Responsive : petits écrans — conserver proportion 4:3, iframe remplit le conteneur */
@media (max-width: 768px) {
    .chemistry-chart-container,
    .msp-sheet-card-container {
        min-height: 200px;
    }
    .chemistry-chart-container iframe,
    .msp-sheet-card-container iframe {
        height: 100%;
        min-height: 200px;
    }
}
/* Dark mode Google Sheets */
[data-theme="dark"] .chemistry-chart-card,
[data-theme="dark"] .msp-sheet-card {
    background: var(--chart-bg);
    box-shadow: var(--shadow-card, 0 2px 10px rgba(0, 0, 0, 0.2));
}
[data-theme="dark"] .msp-sheet-card-header { border-bottom-color: var(--chart-border); }
[data-theme="dark"] .msp-sheet-card-title { color: var(--text-primary); }
[data-theme="dark"] .msp-sheet-card-header i { color: var(--accent-primary); }

/* ----- FILTRAGE + ÉTAT DU SYSTÈME (2 colonnes MSP/N3PP) ----- */
.filter-health-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
    align-items: start;
}
.filter-health-row .filter-section,
.filter-health-row .system-health-panel {
    margin: 0;
}
@media (max-width: 768px) {
    .filter-health-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ----- FILTER SECTION ----- */
.filter-section {
    background: rgba(255,255,255,0.95);
    border-radius: 14px;
    padding: 20px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-card, 0 2px 10px rgba(0,0,0,0.06));
}
/* Titre « Filtrage des données » : même style que .section-header (vert/orange selon page) */
.filter-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #008B74;
}
.filter-header i {
    color: #008B74;
    font-size: 1.2em;
    flex-shrink: 0;
    line-height: 1;
}
.filter-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.15em;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.filter-section h3 {
    margin: 0 0 14px;
    color: #2c3e50;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-section h3 i { color: #008B74; }
.filter-header h3 i { color: #008B74; }
.filter-section form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.filter-section label {
    font-size: 0.85em;
    font-weight: 600;
    color: #555;
    display: block;
    margin-bottom: 4px;
}
.filter-section input[type="datetime-local"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9em;
}
.filter-section input:focus {
    border-color: #008B74;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,139,116,0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary {
    background: #008B74;
    color: white;
}
.btn-primary:hover { background: #00A896; }
.btn-secondary {
    background: #f0f0f0;
    color: #555;
}
.btn-secondary:hover { background: #e0e0e0; }

.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.quick-filter-btn {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    background: rgba(0,139,116,0.08);
    color: #008B74;
    border: 1px solid rgba(0,139,116,0.15);
    transition: all 0.2s;
}
.quick-filter-btn:hover {
    background: #008B74;
    color: white;
}
/* Override main.css button styles : quick-filter-btn identique partout (référence page météo) */
button.quick-filter-btn {
    height: auto;
    line-height: inherit;
    background: rgba(0,139,116,0.08) !important;
    box-shadow: none !important;
    color: #008B74 !important;
}
button.quick-filter-btn:hover {
    background: #008B74 !important;
    color: white !important;
    box-shadow: none !important;
}
/* État sélectionné (timelapse, futures pages données) */
.quick-filter-btn.active {
    background: #008B74;
    color: white;
    border-color: #008B74;
}
button.quick-filter-btn.active {
    background: #008B74 !important;
    color: white !important;
    border-color: #008B74 !important;
    box-shadow: none !important;
}
.period-info {
    display: flex;
    gap: 1.5rem;
    margin-top: 10px;
    font-size: 0.88em;
    color: var(--text-secondary, #6b7280);
}
.period-info i { color: #008B74; margin-right: 4px; }

.tide-stats-definitions {
    font-size: 0.9em;
    color: var(--text-muted, #6c757d);
    margin: 0 0 1rem 0;
}

/* ----- DATA TABLE ----- */
.data-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.data-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.88em;
}
.data-table-wrap th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #e0e0e0;
}
.data-table-wrap td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
}
.data-table-wrap tr:hover td { background: #f8fffe; }

/* ----- NO DATA ----- */
.no-data {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--footer-color, #6b7280);
    font-size: 0.95em;
}
.no-data .no-data-icon {
    font-size: 2em;
    margin-bottom: 10px;
    color: var(--text-muted, #9ca3af);
}
.data-sensor-caption {
    font-size: 0.9em;
    color: var(--text-muted, #7f8c8d);
    margin-top: 1rem;
}
[data-theme="dark"] .no-data .no-data-icon,
[data-theme="dark"] .no-data-icon { color: var(--text-muted); }
[data-theme="dark"] .data-sensor-caption { color: var(--text-muted); }
.dashboard-no-data {
    text-align: center;
    padding: 30px;
    color: var(--text-muted, #7f8c8d);
    margin: 0;
}
[data-theme="dark"] .dashboard-no-data { color: var(--text-muted); }

/* ----- CONTEXT BADGES (footer) ----- */
.context-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}
.context-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
    background: rgba(0,139,116,0.08);
    color: #008B74;
    border: 1px solid rgba(0,139,116,0.15);
}
.context-badge-test { background: #fff3cd; color: #856404; border-color: #ffc107; }
.context-badge-prod { background: #d4edda; color: #155724; border-color: #c3e6cb; }

/* Dashboard : badges plus grands */
.context-badges-dashboard { gap: 12px; margin: 10px 0 25px 0; }
.context-badges-dashboard .context-badge { padding: 8px 16px; gap: 8px; font-size: 0.85em; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 999px; background: rgba(0, 0, 0, 0.05); color: #2c3e50; border: 1px solid rgba(0, 139, 116, 0.15); backdrop-filter: blur(6px); }
.context-badges-dashboard .context-badge-prod { background: rgba(0, 139, 116, 0.1); color: #00523f; border-color: rgba(0, 139, 116, 0.3); }
.context-badges-dashboard .context-badge-test { background: rgba(255, 159, 67, 0.15); color: #a35500; border-color: rgba(255, 159, 67, 0.35); }

/* Variantes stat-card pour indicateurs signés (tide_stats : variation +/-) */
.stat-card.positive .stat-card-icon,
.stat-card.positive .stat-card-value { color: #27ae60; }
.stat-card.negative .stat-card-icon,
.stat-card.negative .stat-card-value { color: #e74c3c; }
.stat-card.neutral .stat-card-icon,
.stat-card.neutral .stat-card-value { color: #3498db; }

/* Bannière info (dashboard, tide_stats) */
.info-banner {
    background: linear-gradient(135deg, #007E61 0%, #00B794 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 126, 97, 0.3);
}
.info-banner-title { font-size: 0.9em; opacity: 0.9; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.info-banner-value { font-size: 1.3em; font-weight: bold; }
.info-banner-details { margin-top: 10px; font-size: 0.95em; }

/* Quick links grid (dashboard) */
.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin: 20px 0 35px 0;
}
.quick-link-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px;
    border-radius: 14px;
    text-decoration: none;
    background: white;
    color: #2c3e50;
    border: 1px solid rgba(0, 139, 116, 0.15);
    box-shadow: var(--shadow-card, 0 2px 10px rgba(0, 139, 116, 0.12));
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.quick-link-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover, 0 8px 24px rgba(0, 139, 116, 0.22));
}
.quick-link-card i { font-size: 1.6em; color: #008B74; }
.quick-link-title { font-weight: 700; font-size: 1.05em; }
.quick-link-description { font-size: 0.85em; color: #546e7a; line-height: 1.35; }

/* Tableau moderne (dashboard) */
.modern-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}
.modern-table table { width: 100%; border-collapse: collapse; }
.modern-table th {
    background: linear-gradient(135deg, #007E61 0%, #00B794 100%);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95em;
}
.modern-table td { padding: 12px 15px; border-bottom: 1px solid #f0f0f0; }
.modern-table tr:last-child td { border-bottom: none; }
.modern-table tbody tr:hover { background: #f8f9fa; }

/* Datetime grid (tide_stats formulaire) */
.datetime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}
.datetime-field { display: flex; flex-direction: column; gap: 8px; }
.datetime-field label { font-weight: 600; color: #2c3e50; font-size: 0.95em; }
.datetime-field input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
    background: white;
}
.datetime-field input:focus {
    outline: none;
    border-color: #008B74;
    box-shadow: 0 0 0 3px rgba(0, 139, 116, 0.1);
}

/* ----- LAYOUT DONNÉES À GAUCHE, GRAPHIQUE À DROITE (style aquaponie) ----- */
.alt-data-chart-row {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(400px, 1.5fr);
    gap: 1.25rem;
    align-items: stretch;
    margin: 15px 0;
    min-width: 0;
}
.alt-data-chart-row > * { min-width: 0; }
.alt-data-chart-row .alt-stats-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}
.alt-data-chart-row .alt-stats-column .stats-grid {
    margin: 10px 0;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.alt-data-chart-row .alt-stats-column .stats-grid .stat-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: 100%;
    max-width: calc((100% - 10px) / 2);
    justify-self: center;
    margin-left: auto;
    margin-right: auto;
}
.alt-data-chart-row .alt-stats-column .stat-card { padding: 8px 10px; }
.alt-data-chart-row .alt-stats-column .stat-card-icon { font-size: 1.4em; margin-bottom: 4px; }
.alt-data-chart-row .alt-stats-column .stat-card-value { font-size: 1.15em; }
.alt-data-chart-row .alt-stats-column .stat-card-label { font-size: 0.82em; }
.alt-data-chart-row .alt-stats-column .stat-card .progress-bar-container { margin: 3px 0; height: 6px; }
.alt-data-chart-row .alt-stats-column .stat-card-secondary { font-size: 0.7em; margin-top: 2px; color: #6c757d; }
.alt-chart-column {
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.6);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,139,116,0.06);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.alt-chart-column .chart-legend-items { margin: 8px 0 0; padding-top: 8px; }
.alt-section-title-full { width: 100%; margin: 20px 0 12px 0 !important; }
.alt-data-chart-row + .alt-data-chart-row { margin-top: 15px; padding-top: 15px; border-top: 1px solid rgba(0,139,116,0.15); }
/* Section chimie : même zone visuelle que Niveaux d'eau et Paramètres physiques (alt-chart-column) */
.alt-chemistry-row > .alt-chemistry-section { grid-column: 1 / -1; }

/* ----- RESPONSIVE ----- */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .quick-links-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 14px; }
    .stat-card-value { font-size: 1.3em; }
    .filter-section form { flex-direction: column; }
    .alt-data-chart-row { grid-template-columns: 1fr; }
    .alt-data-chart-row .alt-stats-column .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .alt-data-chart-row .alt-stats-column .stats-grid .stat-card:last-child:nth-child(odd) {
        grid-column: 1 / -1; width: 100%; max-width: calc((100% - 10px) / 2); justify-self: center; margin-left: auto; margin-right: auto;
    }
}

/* ----- DARK MODE ----- */
[data-theme="dark"] .section-header {
    border-bottom-color: var(--accent-primary);
}
[data-theme="dark"] .section-header i { color: var(--accent-primary); }
[data-theme="dark"] .section-header h3 { color: var(--text-primary); }

[data-theme="dark"] .stat-card {
    background: var(--bg-card);
    box-shadow: var(--shadow-card, 0 2px 10px rgba(0,0,0,0.2));
}
[data-theme="dark"] .stat-card:hover {
    box-shadow: var(--shadow-card-hover, 0 6px 18px rgba(45, 212, 191, 0.15));
}
[data-theme="dark"] .stat-card-icon,
[data-theme="dark"] .stat-card-label,
[data-theme="dark"] .stat-card-unit { color: var(--text-secondary); }
[data-theme="dark"] .stat-card-value { color: var(--text-primary); }
[data-theme="dark"] .stat-card-secondary { color: var(--text-muted); }
[data-theme="dark"] .stat-card.pump {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

[data-theme="dark"] .progress-bar-container { background: var(--bg-secondary); }
[data-theme="dark"] .progress-bar { background: var(--accent-primary); }

[data-theme="dark"] .chart-container {
    background: var(--chart-bg);
    box-shadow: var(--shadow-card, 0 2px 10px rgba(0,0,0,0.2));
}
[data-theme="dark"] .chart-container-title { color: var(--text-primary); }
[data-theme="dark"] .chart-container-title i { color: var(--accent-primary); }
[data-theme="dark"] .chart-legend,
[data-theme="dark"] .chart-legend-items { color: var(--text-secondary); border-top-color: var(--chart-border); }

[data-theme="dark"] .filter-section {
    background: var(--chart-bg);
    box-shadow: var(--shadow-card, 0 2px 10px rgba(0,0,0,0.2));
}
[data-theme="dark"] .filter-header {
    border-bottom-color: var(--accent-primary);
}
[data-theme="dark"] .filter-header i { color: var(--accent-primary); }
[data-theme="dark"] .filter-section h3 { color: var(--text-primary); }
[data-theme="dark"] .filter-section h3 i,
[data-theme="dark"] .filter-header h3 i { color: var(--accent-primary); }
[data-theme="dark"] .filter-section label { color: var(--text-secondary); }
[data-theme="dark"] .filter-section input[type="datetime-local"] {
    border-color: var(--border-color);
    background: var(--bg-input);
}
[data-theme="dark"] .filter-section input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

[data-theme="dark"] .btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
[data-theme="dark"] .btn-secondary:hover { background: var(--border-color); }

[data-theme="dark"] .quick-filter-btn {
    background: var(--accent-muted);
    color: var(--accent-primary);
    border-color: var(--accent-border);
}
[data-theme="dark"] .quick-filter-btn:hover {
    background: var(--accent-primary);
    color: white;
}
/* Surcharge main.css pour button.quick-filter-btn en dark mode */
[data-theme="dark"] button.quick-filter-btn {
    background: var(--accent-muted) !important;
    color: var(--accent-primary) !important;
    box-shadow: none !important;
}
[data-theme="dark"] button.quick-filter-btn:hover {
    background: var(--accent-primary) !important;
    color: white !important;
    box-shadow: none !important;
}
[data-theme="dark"] .quick-filter-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}
[data-theme="dark"] button.quick-filter-btn.active {
    background: var(--accent-primary) !important;
    color: white !important;
    border-color: var(--accent-primary) !important;
}
[data-theme="dark"] .period-info { color: var(--text-secondary); }
[data-theme="dark"] .period-info i { color: var(--accent-primary); }

[data-theme="dark"] .data-table-wrap {
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
[data-theme="dark"] .data-table-wrap table { background: var(--bg-card); }
[data-theme="dark"] .data-table-wrap th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-color: var(--border-color);
}
[data-theme="dark"] .data-table-wrap td {
    border-bottom-color: var(--border-light);
    color: var(--text-secondary);
}
[data-theme="dark"] .data-table-wrap tr:hover td { background: var(--bg-card-hover); }

[data-theme="dark"] .no-data { color: var(--text-muted); }
[data-theme="dark"] .no-data .no-data-icon { color: var(--text-muted); }
[data-theme="dark"] .data-sensor-caption { color: var(--text-muted); }
[data-theme="dark"] .no-data-icon { color: var(--text-muted); }
[data-theme="dark"] .data-sensor-caption { color: var(--text-muted); }
[data-theme="dark"] .no-data-icon { color: var(--text-muted); }
[data-theme="dark"] .data-sensor-caption { color: var(--text-muted); }
[data-theme="dark"] .no-data-icon { color: var(--text-muted); }
[data-theme="dark"] .data-sensor-caption { color: var(--text-muted); }

[data-theme="dark"] .context-badge {
    background: var(--accent-muted);
    color: var(--accent-primary);
    border-color: var(--accent-border);
}
[data-theme="dark"] .context-badge-test {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
    border-color: rgba(251, 146, 60, 0.4);
}
[data-theme="dark"] .context-badge-prod {
    background: var(--accent-muted);
    color: var(--accent-primary);
    border-color: var(--accent-border);
}

[data-theme="dark"] .alt-chart-column {
    background: var(--chart-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
[data-theme="dark"] .alt-data-chart-row + .alt-data-chart-row { border-top-color: var(--accent-border); }

[data-theme="dark"] .info-banner { background: linear-gradient(135deg, #0d9488 0%, #2dd4bf 100%); }
[data-theme="dark"] .quick-link-card {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--accent-border);
}
[data-theme="dark"] .quick-link-card:hover { box-shadow: var(--shadow-card-hover, 0 8px 24px rgba(45, 212, 191, 0.2)); }
[data-theme="dark"] .quick-link-card i { color: var(--accent-primary); }
[data-theme="dark"] .quick-link-description { color: var(--text-secondary); }
[data-theme="dark"] .modern-table { background: var(--bg-card); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
[data-theme="dark"] .modern-table td { border-bottom-color: var(--border-light); }
[data-theme="dark"] .modern-table tbody tr:hover { background: var(--bg-card-hover); }
[data-theme="dark"] .datetime-field label { color: var(--text-primary); }
[data-theme="dark"] .datetime-field input { border-color: var(--border-color); background: var(--bg-input); }
[data-theme="dark"] .datetime-field input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 2px var(--accent-muted); }
