:root {
    --app-primary: #0f4c81;
    --app-primary-dark: #0d3f6a;
    --app-accent: #2e7bbb;
    --app-bg-top: #edf5ff;
    --app-bg-mid: #f6f9fc;
    --app-bg-bottom: #fbfbfd;
    --app-border: #e3e8ef;
    --app-text-muted: #6b7280;
    --app-text-medium: #4b5563;
}

body {
    background: radial-gradient(circle at top right, var(--app-bg-top) 0, var(--app-bg-mid) 40%, var(--app-bg-bottom) 100%);
    color: #111827;
}

.app-navbar {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(15, 76, 129, 0.12);
}

.brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--app-primary-dark);
}

.app-navbar .navbar-toggler {
    border-color: rgba(15, 76, 129, 0.25);
}

.app-navbar .nav-link {
    font-weight: 600;
    color: var(--app-primary-dark);
    border-radius: 0.5rem;
    padding: 0.35rem 0.65rem;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
    background-color: rgba(46, 123, 187, 0.12);
    color: var(--app-primary-dark);
}

.app-navbar .nav-link.active {
    background-color: rgba(46, 123, 187, 0.18);
    color: var(--app-primary-dark);
}

.app-page {
    padding-top: 1.4rem;
    padding-bottom: 2rem;
}

body .charts {
    max-width: none;
}

.page-head h1 {
    margin-bottom: 0.3rem;
}

.home-hero {
    position: relative;
    background: linear-gradient(120deg, var(--app-primary) 0%, #16629f 45%, var(--app-accent) 100%);
    border-radius: 1rem;
    overflow: hidden;
    color: #fff;
}

.hero-glow {
    position: absolute;
    width: 24rem;
    height: 24rem;
    right: -6rem;
    top: -10rem;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0, rgba(255, 255, 255, 0) 70%);
}

.hero-content {
    position: relative;
    padding: 1.5rem;
}

.eyebrow {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
}

.hero-stat {
    border-radius: 0.75rem;
}

.hero-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-right: 0.5rem;
    color: var(--app-primary);
}

.hero-stat-label {
    font-size: 0.9rem;
    color: #5d6472;
}

.installation-card,
.form-card,
.auth-card,
.map-card {
    border-radius: 1rem;
    background-color: #fff;
}

.installation-title {
    font-size: 1.35rem;
    margin: 0;
}

.data-panel {
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    padding: 1rem;
    background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
}

.panel-title {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
}

.chart-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.monthly-chart-shell {
    position: relative;
    width: 100%;
    height: 640px;
}

.alert-shell {
    background-color: #f3f4f6;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
}

.alert-impact {
    display: inline-block;
    padding: 0 6px;
    border-radius: 5px;
    font-weight: 700;
    color: #fff;
    font-family: monospace;
}

.app-table thead th {
    border-bottom: 1px solid var(--app-border);
    background-color: #f8fafc;
    color: #374151;
}

.app-table tbody tr td {
    border-color: var(--app-border);
}

.auth-shell {
    max-width: 560px;
    margin: 1rem auto 0;
}

.comment-link {
    text-decoration: none;
}

.comment-link:hover {
    text-decoration: underline;
}

.card.comment .card-body {
    background-color: #fff9df;
}

.card.comment {
    max-width: 100%;
}

/* Ligne de temps de l'historique des commentaires */
.comment-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 2px solid var(--app-border);
}

.comment-timeline-item {
    position: relative;
    padding: 0 0 1.25rem 1.5rem;
}

.comment-timeline-item:last-child {
    padding-bottom: 0;
}

.comment-timeline-item::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 0.35rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--app-primary);
    border: 2px solid #fff;
}

.comment-timeline-item--deleted::before {
    background: var(--app-text-muted);
}

.comment-timeline-meta {
    font-size: 0.85rem;
    color: var(--app-text-muted);
    margin-bottom: 0.25rem;
}

.comment-timeline-item--deleted .comment-timeline-meta {
    font-style: italic;
}

.comment-timeline-message {
    color: var(--app-text-medium);
}

.form-card .form-control,
.form-card .form-select,
.auth-card .form-control,
.auth-card .form-select,
textarea.form-control {
    border-color: #d2dae4;
}

.form-card .form-control:focus,
.form-card .form-select:focus,
.auth-card .form-control:focus,
.auth-card .form-select:focus,
textarea.form-control:focus {
    border-color: #7cb0df;
    box-shadow: 0 0 0 0.2rem rgba(46, 123, 187, 0.2);
}

.text-small {
    font-size: 0.875rem;
    color: var(--app-text-muted);
}

.text-medium {
    font-size: 1rem;
    color: var(--app-text-medium);
}

.doc-entry-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0.75rem 0;
}

@media (max-width: 991.98px) {
    .hero-content {
        padding: 1.2rem;
    }

    .installation-title {
        font-size: 1.15rem;
    }

    .app-page {
        padding-top: 1rem;
    }
}

/* Laboratoire d'analyse */

/* Bandeau compact : ce que l'on regarde, tenu sur une ligne, toujours visible même
   quand le formulaire est replié. */
.lab-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .6rem .9rem;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    background-color: #f8f9fa;
}

.lab-bar-summary {
    font-size: .95rem;
    color: #343a40;
}

.lab-bar-sep {
    color: #adb5bd;
    margin: 0 .15rem;
}

.lab-bar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.lab-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .6rem;
}

.lab-chip {
    display: inline-flex;
    align-items: baseline;
    gap: .35rem;
    padding: .2rem .5rem;
    border: 1px solid #b6d4fe;
    border-radius: 1rem;
    background-color: #e7f1ff;
    font-size: .85rem;
}

.lab-chip-dimension {
    color: #6c757d;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.lab-chip-open {
    color: #6c757d;
    font-size: .78rem;
    font-style: italic;
}

.lab-chip-remove {
    color: #6c757d;
    text-decoration: none;
    font-size: 1.05rem;
    line-height: 1;
}

.lab-chip-remove:hover,
.lab-chip-remove:focus {
    color: #b02a37;
}

.lab-form-collapse {
    margin-top: 1rem;
}

.lab-fieldset {
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    padding: 1rem;
}

.lab-legend {
    float: none;
    width: auto;
    font-size: .9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6c757d;
    padding: 0 .4rem;
}

/* Hauteur fixe : sans elle, Chart.js grandit à chaque redimensionnement. */
.lab-chart-shell {
    height: 420px;
}

.lab-table .lab-empty-cell {
    color: #adb5bd;
}

.lab-table .lab-secondary {
    color: #6c757d;
    font-size: .85em;
}

.lab-table .lab-unit {
    font-weight: 400;
    font-size: .85rem;
    color: #6c757d;
}

.lab-table tfoot .lab-total {
    font-weight: 600;
    border-top: 2px solid #dee2e6;
}
