/* Base & Typography */
body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    color: #2c3e50;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

:root {
    --airtable-cyanLight1: #7fd5ea;
    --airtable-grayDark1: #6c7a89;
    --airtable-grayLight2: #d3d8de;
    --airtable-grayLight1: #b9c0c7;
    --airtable-blueLight2: #8ab6ff;
    --airtable-blueLight1: #6fa8ff;
    --airtable-greenLight1: #73d69a;
    --airtable-greenLight2: #9be7b2;
    --airtable-redLight1: #ff9c9c;
    --airtable-redBright: #ff6b6b;
    --airtable-greenBright: #2ecc71;
    --airtable-yellowLight1: #f6d365;
    --market-panel-width: 420px;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 600;
}

/* Map */
#map {
    height: calc(100vh - 110px);
    min-height: 320px;
    width: 100%;
    z-index: 1;
}

#map-view-container {
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden;
}

#map .leaflet-bottom.leaflet-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

#map .leaflet-bottom.leaflet-right .leaflet-control {
    float: none;
    margin-right: 14px;
    margin-bottom: 0;
}

#map .leaflet-bottom.leaflet-right .leaflet-control-zoom {
    order: 2;
}

#map .leaflet-bottom.leaflet-right .leaflet-control-distance-scale {
    order: 3;
    margin-bottom: 7px;
    border: 2px solid #d8dde3
}

#map .leaflet-bottom.leaflet-right .leaflet-control-distance-measure {
    order: 1;
}

#map .leaflet-bottom.leaflet-right .leaflet-control-attribution {
    order: 4;
    display: none;
}

#map .leaflet-control-zoom a {
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 16px;
}

#map .leaflet-control-distance-measure .distance-measure-toggle {
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 13px;
    text-align: center;
    color: #2c3e50;
    background: #fff;
}

#map .leaflet-control-distance-measure .distance-measure-toggle.active {
    color: #1f8d4d;
    background: #eefaf3;
}

#map.distance-measure-mode {
    cursor: crosshair;
}

#map.distance-measure-mode .leaflet-interactive {
    cursor: crosshair;
}

#map.distance-measure-mode .leaflet-marker-icon,
#map.distance-measure-mode .leaflet-interactive,
#map.distance-measure-mode .marker-cluster {
    pointer-events: none !important;
}

#map .leaflet-control-distance-scale .map-distance-scale {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 3px 6px 4px;
    min-width: 0;
    box-shadow: none;
}

#map .leaflet-control-distance-scale {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: none;
    overflow: hidden;
}

#admin-container {
    min-height: calc(100vh - 110px);
    display: flex;
    flex-direction: column;
}

/* Sidebar Styling */
#sidebar {
    position: absolute;
    top: 10px;
    left: 20px;
    width: 280px;
    max-height: calc(100vh - 130px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    transition: transform 0.3s ease;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: auto;
    overflow: hidden;
}

#sidebar.closed {
    transform: translateX(-360px);
}

#sidebar .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #fff;
    border-bottom: 1px solid #f1f2f6;
}

#sidebar .sidebar-header h2 {
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon-refresh {
    background: #f8f9fa;
    border: 1px solid #dfe6e9;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    color: #7f8c8d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.btn-icon-refresh:hover {
    background: #fff;
    border-color: #27ae60;
    color: #27ae60;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}


#sidebar h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    flex-grow: 1;
}

.scrollable-content {
    padding: 10px;
    overflow-y: auto;
    min-height: 0;
}

/* Search Box */
.search-box {
    position: relative;
    margin-bottom: 10px;
}

.search-box > i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
    font-size: 0.8rem;
}

.search-box input {
    width: 100%;
    box-sizing: border-box;
    padding: 5px 8px 5px 25px;
    border: 1px solid #dfe6e9;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.75rem;
    outline: none;
    transition: border-color 0.2s;
    background: #fdfdfd;
}

.search-box input:focus {
    border-color: #27ae60;
    background: #fff;
}

.search-box > i {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
    font-size: 0.7rem;
}

.search-box.has-clear input {
    padding-right: 24px;
}

.search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 9px;
    background: #f1f2f6;
    color: #7f8c8d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.search-clear:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.search-clear i {
    font-size: 0.65rem;
    line-height: 1;
}

.search-clear.hidden {
    display: none;
}

.search-box.compact {
    margin-bottom: 8px;
}

.tree-group-search {
    margin-top: 6px;
    margin-bottom: 8px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #eee;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
}

.search-results.hidden {
    display: none;
}

.search-result-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f9f9f9;
    font-size: 0.9rem;
}

.search-result-item:hover {
    background: #f1f2f6;
}

/* Accordions */
.accordion-section {
    border: 1px solid #f1f2f6;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fff;
    overflow: hidden;
    transition: all 0.2s;
}

.accordion-section[open] {
    border-color: #e1e2e6;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.accordion-section summary {
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    user-select: none;
    outline: none;
}

.accordion-section summary span {
    display: flex;
    align-items: center;
}

.accordion-section summary i {
    font-size: 0.8rem;
    color: #bdc3c7;
    transition: transform 0.2s;
    padding-right: 10px;
}

.accordion-section[open] summary i {
    transform: rotate(180deg);
}

.accordion-section summary::-webkit-details-marker {
    display: none;
}

/* Hide default triangle */

.accordion-section summary:hover {
    background-color: #fbfbfb;
}

.badgem {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.badgem.producer {
    background: #27ae60;
    box-shadow: 0 0 4px #27ae60;
}

.badgem.outlet {
    background: #3498db;
    box-shadow: 0 0 4px #3498db;
}

.badgem.transporter {
    background: #9b59b6;
    box-shadow: 0 0 4px #9b59b6;
}

.badgem.gisement {
    background: #f39c12;
    box-shadow: 0 0 4px #f39c12;
}

.company-popup {
    min-width: 260px;
    max-width: 320px;
    color: #2c3e50;
    font-size: 0.85rem;
    background: #fff;
}

.company-popup--producer {
    background: linear-gradient(
        135deg,
        var(--company-popup-accent-soft, rgba(39, 174, 96, 0.08)),
        rgba(255, 255, 255, 1) 55%
    );
    padding: 10px 18px;
}

.leaflet-popup.popup-theme-producer .leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
}

.leaflet-popup.popup-theme-producer .leaflet-popup-content {
    margin: 0;
}

.leaflet-popup.popup-theme-producer .leaflet-popup-close-button {
    top: 8px;
    right: 8px;
}

.leaflet-popup.popup-theme-producer .company-popup__icons {
    margin-right: 18px;
}

.company-popup__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.company-popup__title {
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #2c3e50;
}

.company-popup__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    color: #7f8c8d;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
}

.company-popup__meta-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(44, 62, 80, 0.08);
    font-size: 0.74rem;
    line-height: 1;
    margin-right: 2px;
}

.company-popup__score {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.68rem;
    font-weight: 700;
    color: #a04000;
    background: #fdebd0;
    border: 1px solid #f5cba7;
    border-radius: 999px;
    padding: 1px 7px;
}

.company-popup__score-trigger {
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
}

.company-popup__score-trigger:hover {
    background: #f9e4c3;
}

.company-popup__partner {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.68rem;
    font-weight: 700;
    color: #0b5345;
    background: #d4efdf;
    border: 1px solid #a9dfbf;
    border-radius: 999px;
    padding: 1px 7px;
}

.company-popup__icons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-popup__iconlink {
    color: #7f8c8d;
    text-decoration: none;
    font-size: 0.9rem;
}

.company-popup__iconlink:hover {
    color: #2c3e50;
}

.company-popup__options-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    color: #7f8c8d;
    font-size: 0.95rem;
    padding: 2px 4px;
    line-height: 1;
}

.company-popup__options-btn:hover {
    color: #2c3e50;
}

.company-popup__materials {
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #eef1f6;
    background: #f8f9fb;
}

.company-popup__materials-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #95a5a6;
    letter-spacing: 0.05em;
}

.company-popup__materials-value {
    margin-top: 2px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
}

.company-popup__details {
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #e8edf5;
    background: #f7f9fc;
}

.company-popup__detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin: 2px 0;
}

.company-popup__detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #6c7a89;
    letter-spacing: 0.04em;
    font-weight: 700;
    white-space: nowrap;
}

.company-popup__detail-label i {
    margin-right: 4px;
    color: #95a5a6;
}

.company-popup__detail-value {
    font-size: 0.74rem;
    color: #2c3e50;
    text-align: right;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.company-popup__tag-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
}

.company-popup__tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid #d9e3f2;
    background: #eef3fb;
    color: #1f3e5a;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.2;
    max-width: 100%;
}

.company-popup__tag-swatch {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.company-popup__material-link {
    color: #1f6aa5;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.company-popup__material-link:hover {
    color: #164f7d;
}

.company-popup__score-breakdown {
    margin-top: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    border: 1px solid #f5d7a6;
    background: #fef8ec;
}

.company-popup__score-breakdown.is-collapsed {
    display: none;
}

.company-popup__score-breakdown-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    color: #9c640c;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.company-popup__score-updated-at {
    margin-top: 4px;
    font-size: 0.7rem;
    color: #a86f1d;
    font-weight: 600;
}

.company-popup__score-section {
    margin-top: 6px;
}

.company-popup__score-section-title {
    font-size: 0.74rem;
    color: #7e5109;
    font-weight: 700;
}

.company-popup__score-line {
    margin-top: 3px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.72rem;
    color: #6e2c00;
}

.company-popup__score-line span:last-child {
    font-weight: 600;
    white-space: nowrap;
}

.company-popup__score-subtotal {
    margin-top: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #935116;
}

.company-popup__score-total {
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px dashed #edbb99;
    font-size: 0.78rem;
    font-weight: 800;
    color: #7e5109;
}

.company-popup__score-breakdown-text {
    margin: 6px 0 0 0;
    white-space: pre-wrap;
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    line-height: 1.3;
    color: #6e2c00;
}

.company-popup__contact {
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #ecf0f1;
    background: #fff;
}

.company-popup__contact-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 2px 0;
    color: #34495e;
}

.company-popup__contact-row i {
    width: 14px;
    color: #95a5a6;
}

.company-popup__quick-actions {
    margin-top: 6px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.company-popup__quick-action {
    border: 1px solid #d9e0e6;
    background: #f8f9fa;
    color: #2f3a44;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    transition: background 0.2s, border-color 0.2s;
}

.company-popup__quick-action:hover {
    background: #eef1f4;
    border-color: #cfd7de;
}

.company-popup__options {
    display: none;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #ecf0f1;
    gap: 6px;
    flex-wrap: wrap;
}

.company-popup__options-empty {
    font-size: 0.72rem;
    color: #7f8c8d;
}

.count-badge {
    font-size: 0.75rem;
    color: #95a5a6;
    font-weight: 400;
    background: #f1f2f6;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.accordion-content {
    padding: 5px 10px;
    border-top: 1px solid #f1f2f6;
    background: #fcfcfc;
}

/* Sub-Accordions */
.sub-accordion {
    margin-bottom: 5px;
    border: 1px solid #f1f2f6;
    border-radius: 6px;
    background: white;
}

.sub-accordion summary {
    padding: 6px 10px;
    font-size: 0.8rem;
    color: #34495e;
}

.summary-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.accordion-section summary .summary-left .summary-type-icon {
    font-size: 0.68rem;
    color: #000;
    padding-right: 0;
}

.accordion-section[open] summary .summary-left .summary-type-icon {
    transform: none;
}

.sub-content {
    padding: 8px;
    border-top: 1px solid #f1f2f6;
}

/* Status Toggle (Visibility) */
.status-toggle {
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: #95a5a6;
    border: 1px solid #dfe6e9;
    background: white;
    margin-right: 8px;
}

.status-toggle:hover {
    background: #f1f2f6;
    color: #2c3e50;
}

.status-toggle.st-visible {
    color: #27ae60;
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.status-toggle.st-transparent {
    color: #3498db;
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.status-toggle.st-hidden {
    color: #95a5a6;
    border-color: #dfe6e9;
    background: white;
}

.compact-list,
.filter-list.compact {
    max-height: 150px;
    font-size: 0.75rem;
}

/* Filters */
.filter-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.filter-list label {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: #57606f;
    cursor: pointer;
    line-height: 1.4;
}

.filter-list label:hover {
    color: #2c3e50;
}

.filter-list input {
    margin-right: 8px;
    margin-top: 3px;
    accent-color: #2c3e50;
}

/* Tree filters */
.tree-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #2c3e50;
    margin-bottom: 8px;
}

.data-jobs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 2px;
}

.data-jobs-group {
    border: 1px solid #f1f2f6;
    border-radius: 7px;
    background: #fff;
    padding: 8px;
}

.data-jobs-group-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #7f8c8d;
    margin-bottom: 6px;
    font-weight: 700;
}

.data-job-btn {
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 6px;
}

.data-job-btn:last-child {
    margin-bottom: 0;
}

.data-job-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.data-job-btn .data-job-label {
    font-weight: 600;
    color: #2c3e50;
}

.data-job-btn .data-job-desc {
    font-size: 0.72rem;
    color: #7f8c8d;
}

.data-jobs-status {
    margin-top: 8px;
    font-size: 0.74rem;
    color: #7f8c8d;
}

#data-jobs-section .sub-content {
    max-height: 330px;
    overflow-y: auto;
}

.data-jobs-status.state-running {
    color: #b9770e;
    font-weight: 600;
}

.data-jobs-status.state-success {
    color: #1e8449;
    font-weight: 600;
}

.data-jobs-status.state-error {
    color: #c0392b;
    font-weight: 600;
}

.tree-toggle input {
    accent-color: #2c3e50;
}

.tree-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.tree-group {
    border: 1px solid #f1f2f6;
    border-radius: 6px;
    background: #fff;
    padding: 4px 8px 8px 8px;
}

.tree-group summary {
    list-style: none;
}

.tree-group summary::-webkit-details-marker {
    display: none;
}

/* Release modal - sync metadata (very subtle) */
#release-modal .modal-content {
    max-width: 620px;
    padding: 26px 28px;
}

#release-modal .modal-content h3 {
    margin-bottom: 14px;
}

.release-body {
    margin-top: 6px;
    font-size: 0.86rem;
    font-weight: 400;
    color: #2c3e50;
    line-height: 1.35;
}

.release-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

.release-meta-item {
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
}

.release-key {
    font-weight: 500;
    color: #636e72;
}

.release-val {
    font-variant-numeric: tabular-nums;
    color: #2c3e50;
}

.release-feature {
    margin-top: 8px;
}

.release-feature-text {
    margin-top: 2px;
    color: #2c3e50;
}

.release-sync-meta {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f2f6;
    font-size: 0.7rem;
    color: #7f8c8d;
    opacity: 0.85;
}

.release-sync-meta.hidden {
    display: none !important;
}

.release-sync-title {
    font-weight: 500;
    letter-spacing: 0.01em;
    margin-bottom: 6px;
    color: #95a5a6;
}

.release-sync-list {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: baseline;
}

.release-sync-key {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.release-sync-val {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tree-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #34495e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 4px 0;
}

.tree-group-title i {
    font-size: 0.7rem;
    color: #95a5a6;
    transition: transform 0.2s ease;
}

.tree-group[open] .tree-group-title i {
    transform: rotate(180deg);
}

.tree-group-body {
    margin-top: 4px;
}

.tree-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tree-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8rem;
    color: #57606f;
    cursor: pointer;
}

.tree-item input {
    margin-top: 2px;
    accent-color: #2c3e50;
}

.tree-subgroup {
    border: 1px solid #eef2f6;
    border-radius: 6px;
    background: #fcfcfc;
    padding: 6px;
}

.tree-subgroup summary {
    font-size: 0.75rem;
    color: #2c3e50;
    cursor: pointer;
}

.tree-children {
    margin-top: 6px;
    padding-left: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}

.toggle-control.main-toggle {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    display: block;
}

/* Footer / Controls */
.footer-controls {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f1f2f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #95a5a6;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #b2bec3;
    transition: color 0.2s;
    padding: 5px;
}

.btn-icon:hover {
    color: #2d3436;
}

.btn-text {
    background: white;
    border: 1px solid #dfe6e9;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #636e72;
    transition: all 0.2s;
}

.btn-text:hover {
    border-color: #b2bec3;
    color: #2d3436;
    background: #f9f9f9;
}

/* Sidebar Footer Info */
.sidebar-footer {
    padding: 8px 15px;
    border-top: 1px solid #f1f2f6;
    background: #fff;
    display: flex;
    justify-content: flex-end;
    position: relative;
}

.footer-update-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.70rem;
    color: #95a5a6;
}

.footer-update-info .btn-icon-refresh {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
}

.btn-icon-map-legend.active {
    border-color: #27ae60;
    color: #27ae60;
    background: #eefaf3;
}

/* Liseré rouge clair discret : indique que les micro-pictos des marqueurs
   (flèches/étoiles) sont actuellement masqués. */
.btn-icon-map-legend.indicators-hidden {
    border-color: #f6d3ce;
    box-shadow: 0 0 0 1px rgba(231, 76, 60, 0.08);
}

/* Masque les micro-pictos (flèches/étoiles) sur les marqueurs de la carte. */
#map.hide-marker-indicators .marker-indicators {
    display: none;
}

.map-legend-panel {
    position: fixed;
    z-index: 13010;
    width: auto;
    max-width: calc(100vw - 40px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.map-legend-panel.hidden {
    display: none;
}

.map-legend-panel.is-pinned {
    left: auto !important;
    top: auto !important;
    right: 55px !important;
    bottom: 58px;
    transform: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 10px;
}

.map-legend-panel .producer-score-legend,
.map-legend-panel .marker-symbol-legend {
    min-width: 170px;
    width: auto;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.11);
}

/* Hamburger / Tab Toggle */
#sidebar-toggle {
    position: absolute;
    top: 20px;
    left: 300px;
    /* Sidebar (20) + width (280) */
    z-index: 1101;
    /* background: white; */
    background: #27ae60;
    color:white;
    border: none;
    height: 36px;
    width: auto;
    padding: 0 10px;
    border-radius: 0 8px 8px 0;
    box-shadow: none;
    cursor: pointer;
    /* color: #2c3e50; */
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}

#sidebar.closed~#sidebar-toggle {
    left: 0;
    border-radius: 0 6px 6px 0;
    box-shadow: none;
}


/* Show button when hovering it (prevents flickering) */
#sidebar-toggle:hover {
    background: #f8f9fa;
    /* color: #27ae60; */
    color: #27ae60;
    color:white;
}

#sidebar-toggle:focus,
#sidebar-toggle:focus-visible,
#sidebar-toggle:active {
    outline: none;
    box-shadow: none;
}

.sidebar-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-label {
    display: none;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

#sidebar.closed~#sidebar-toggle .sidebar-toggle-label {
    display: inline;
}

.btn-icon-map-style {
    position: relative;
}

.btn-icon-map-style i {
    font-size: 0.72rem;
}

.btn-icon-map-style[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    background: rgba(44, 62, 80, 0.96);
    color: #fff;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 13020;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22);
}

.btn-icon-map-style[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    right: 8px;
    bottom: calc(100% + 3px);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(44, 62, 80, 0.96);
    z-index: 13020;
}

#market-toggle {
    position: fixed;
    top: 90px;
    right: 0;
    z-index: 1101;
    /* background: white; */
    background: #27ae60;
    color:white;
    border: 1px solid #f1f2f6;
    border-right: none;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px 0 0 8px;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    /* color: #2c3e50; */
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#market-toggle.open {
    right: calc(var(--market-panel-width) + 50px);
}

#market-toggle:hover {
    background: #f8f9fa;
    /* color: #27ae60; */
    color: #27ae60;
}

.market-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

#market-toggle.open .market-toggle-icon {
    transform: rotate(180deg);
}

.market-toggle-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

#market-toggle.open {
    padding: 0 8px;
}

#market-toggle.open .market-toggle-label {
    display: none;
}

/* Custom Marker Icons */
.custom-div-icon {
    background: transparent;
    border: none;
}

.marker-wrap {
    position: relative;
    width: 22px;
    height: 28px;
}

.marker-wrap.marker-wrap-search {
    width: 16px;
    height: 20px;
}

.marker-pin {
    width: 22px;
    height: 22px;
    border-radius: 50% 50% 50% 0;
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -11px 0 0 -11px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    /* More depth */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    /* Crisp border */
    transition: transform 0.2s ease;
}

/* Hover Effect */
.marker-pin:hover {
    transform: rotate(-45deg) scale(1.06);
    z-index: 1000 !important;
}

/* Remove the inner white circle that was off-center */
.marker-pin::after {
    display: none;
}

.marker-pin i {
    transform: rotate(45deg);
    z-index: 10;
    font-size: 10px;
    color: white !important;
    /* Force white icon */
    margin: 0;
    /* Perfect centering */
}

.marker-pin.marker-pin-outline {
    background: transparent !important;
    border-width: 2px;
}

.marker-pin.marker-pin-outline i {
    opacity: 0;
}

.marker-indicators {
    position: absolute;
    top: -6px;
    right: -10px;
    display: flex;
    gap: 1px;
    pointer-events: none;
}

.marker-indicator {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.marker-indicator.supply {
    color: #f39c12;
}

.marker-indicator.demand {
    color: #e74c3c;
}

.marker-indicator.partner {
    color: #4468a8;
}

.marker-indicator.client {
    color: #4468a8;
}

.marker-indicator i {
    font-size: 8px;
    line-height: 1;
    color: inherit;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.leaflet-tooltip.marker-name {
    background: rgba(44, 62, 80, 0.92);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.75rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.leaflet-tooltip.marker-name.leaflet-tooltip-top:before {
    border-top-color: rgba(44, 62, 80, 0.92);
}

.leaflet-tooltip.marker-name.leaflet-tooltip-bottom:before {
    border-bottom-color: rgba(44, 62, 80, 0.92);
}

.leaflet-tooltip.crossing-tooltip {
    background: rgba(44, 62, 80, 0.92);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.75rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    max-width: 420px;
    min-width: 260px;
    white-space: normal;
    line-height: 1.3;
}

.leaflet-tooltip.crossing-tooltip.leaflet-tooltip-top:before {
    border-top-color: rgba(44, 62, 80, 0.92);
}

.leaflet-tooltip.crossing-tooltip.leaflet-tooltip-bottom:before {
    border-bottom-color: rgba(44, 62, 80, 0.92);
}

.crossing-tooltip-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    margin-bottom: 4px;
}

.crossing-tooltip-row:last-child {
    margin-bottom: 0;
}

.crossing-tooltip-row i {
    font-size: 0.7rem;
    opacity: 0.9;
    margin-top: 2px;
}

.crossing-tooltip-row span {
    flex: 1;
    word-break: break-word;
}

.crossing-status-block {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.crossing-status-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.crossing-status-title input {
    margin: 0;
}

.crossing-status-title-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    flex: 1;
}

.crossing-status-help {
    position: relative;
    width: 16px;
    height: 16px;
    border: 1px solid #b4bdc8;
    border-radius: 50%;
    color: #6c7a89;
    font-size: 0.68rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: help;
    flex-shrink: 0;
    background: #fff;
}

.crossing-status-help::after {
    content: attr(data-help);
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    min-width: 220px;
    max-width: 280px;
    background: rgba(44, 62, 80, 0.96);
    color: #fff;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    line-height: 1.25;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
    z-index: 20;
}

.crossing-status-help:hover::after,
.crossing-status-help:focus::after,
.crossing-status-help:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.crossing-status-collapse {
    border: none;
    background: transparent;
    color: #7f8c8d;
    cursor: pointer;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 2px;
}

.crossing-status-collapse i {
    transition: transform 0.15s ease;
}

.crossing-status-block.collapsed .crossing-status-list {
    display: none;
}

.crossing-status-block.collapsed .crossing-status-collapse i {
    transform: rotate(-90deg);
}

.crossing-status-block.collapsed .crossing-status-title {
    margin-bottom: 0;
}

.crossing-status-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crossing-status-total {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-left: auto;
}

.crossing-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    flex-wrap: wrap;
}

.crossing-status-item input {
    margin: 0;
}

.crossing-status-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.crossing-status-label {
    flex: 1;
}

.crossing-status-count {
    color: #7f8c8d;
    margin-left: 2px;
    white-space: nowrap;
}

body.crossings-loading,
body.crossings-loading * {
    cursor: progress !important;
}

#crossings-loading-indicator {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 13050;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(44, 62, 80, 0.92);
    color: #fff;
    font-size: 0.78rem;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
    pointer-events: none;
}

#crossings-loading-indicator i {
    font-size: 0.82rem;
}

#crossings-loading-indicator.hidden {
    display: none;
}

#map-data-loading-indicator {
    position: fixed;
    top: 54px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 13040;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(44, 62, 80, 0.86);
    color: #fff;
    font-size: 0.75rem;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
    pointer-events: none;
}

#map-data-loading-indicator i {
    font-size: 0.78rem;
}

#map-data-loading-indicator.hidden {
    display: none;
}

.market-filiere-item:hover,
.market-material-item:hover,
.market-company-material-item:hover,
.market-producer-industry-item:hover,
.market-distance-item:hover {
    background: #f8f9fa;
    border-radius: 6px;
}

.market-distance-item {
    justify-content: space-between;
}

.market-distance-meta {
    color: #7f8c8d;
    font-size: 0.72rem;
    margin-left: auto;
}

.market-distance-empty {
    color: #95a5a6;
    font-size: 0.78rem;
    padding: 4px 2px;
}

.tree-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin: 0 6px 0 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

/* Colors */
.marker-pin.producer {
    background: #27ae60;
}

.marker-pin.producer i {
    color: #27ae60;
}

.marker-pin.producer.marker-pin-outline {
    border-color: #27ae60;
}

.marker-pin.outlet {
    background: #3498db;
}

.marker-pin.outlet i {
    color: #3498db;
}

.marker-pin.transporter {
    background: #9b59b6;
}

.marker-pin.transporter i {
    color: #9b59b6;
}

.marker-pin.gisement {
    background: #f39c12;
}

.marker-pin.gisement i {
    color: #f39c12;
}

/* Geo-fix marker */
.marker-pin.geofix {
    background: #e67e22;
}

.marker-pin.geofix i {
    color: #e67e22;
}

/* Temporary Search Marker */
.marker-pin.search {
    background: #e74c3c;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-width: 1px;
    animation: bounce 0.5s ease infinite alternate;
}

.marker-pin.search i {
    color: #e74c3c;
    font-size: 7px;
}

.producer-score-legend {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(44, 62, 80, 0.18);
    border-radius: 10px;
    padding: 8px 10px;
    color: #2c3e50;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    min-width: 150px;
}

.producer-score-legend.hidden {
    display: none;
}

.producer-score-legend__title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.producer-score-legend__bar {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #e74c3c 0%, #f1c40f 55%, #2ecc71 100%);
}

.producer-score-legend__ticks {
    margin-top: 5px;
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #5d6d7e;
    font-weight: 600;
}

.marker-symbol-legend {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(44, 62, 80, 0.18);
    border-radius: 10px;
    padding: 8px 10px;
    color: #2c3e50;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    min-width: 170px;
}

.marker-symbol-legend.hidden {
    display: none;
}

.marker-symbol-legend__title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.marker-symbol-legend__item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: #415162;
    margin-top: 2px;
}

.marker-symbol-legend__icon {
    width: 12px;
    height: 12px;
}

.map-distance-scale {
    color: #2c3e50;
    min-width: 0;
    flex: 0 0 auto;
}

.map-distance-scale.hidden {
    display: none;
}

.map-distance-scale__title {
    display: none;
}

.map-distance-scale__content {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.map-distance-scale__bar {
    width: 46px;
    height: 5px;
    border-left: 2px solid #2c3e50;
    border-right: 2px solid #2c3e50;
    border-bottom: 2px solid #2c3e50;
    border-radius: 2px;
    flex: 0 0 auto;
}

.map-distance-scale__label {
    font-size: 0.66rem;
    color: #3f4f60;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
}

.distance-measure-label {
    background: rgba(44, 62, 80, 0.92);
    color: #fff;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.25);
    white-space: nowrap;
    line-height: 1.2;
    letter-spacing: 0.01em;
    min-width: 64px;
    text-align: center;
    overflow: visible !important;
    max-width: none !important;
}

@keyframes bounce {
    from {
        margin-top: -9px;
    }

    to {
        margin-top: -12px;
    }
}

/* Notification Toast */

#notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(30, 30, 30, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    animation: fadeIn 0.3s;
}

.toast.error {
    background: #e74c3c;
    /* Red */
}

.toast.success {
    background: #27ae60;
    /* Green */
}

.toast.info {
    background: #3498db;
    /* Blue */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: 0;
    }
}

/* Login Screen */

/* Login Screen */
#login-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh - 40px);
    background: url('https://www.greenr.link/wp-content/uploads/2020/12/1AdobeStock_277658395-e1627401343981.jpeg') no-repeat center center/cover;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    /* Align top */
    justify-content: flex-end;
    /* Align right */
    padding-right: 5%;
    /* Not stuck to right */
    padding-top: 25vh;
    /* Higher up (approx top 1/4) */
    box-sizing: border-box;
}

.login-box {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 340px;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.login-box h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.login-box p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

.auth-panel {
    width: 100%;
}

.login-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    text-align: center;
}

.login-box button {
    width: 100%;
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.login-box button:hover {
    background: #2ecc71;
}

/* Cluster override */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(255, 255, 255, 0.8) !important;
    border: 2px solid #bdc3c7;
    color: #2c3e50;
    font-family: 'Outfit';
}

.marker-cluster div {
    background: transparent !important;
}

/* Route Info Box */
.route-info {
    position: fixed;
    /* Fixed to viewport */
    top: 20px;

    right: 20px;
    z-index: 9999;
}

#route-info-box,
#market-info-box {
    position: fixed;
    right: 20px;
    width: 320px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: visible;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 15px;
    z-index: 1000;
    font-family: 'Outfit', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.5);
    scrollbar-width: thin;
    scrollbar-color: #bdc3c7 transparent;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#route-info-box {
    bottom: 80px;
    top: auto;
}

#market-info-box {
    top: 80px;
    width: var(--market-panel-width);
}

#route-info-box.minimized {
    transform: translateX(380px);
    /* width 320 + right 20 + safety margin */
}

#market-info-box.minimized {
    transform: translateX(calc(var(--market-panel-width) + 60px));
}

.box-toggle-tab {
    position: absolute;
    top: 15px;
    left: -28px;
    width: 28px;
    height: 36px;
    background: white;
    border: 1px solid #f1f2f6;
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    color: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    z-index: 1001;
    transition: all 0.3s ease;
}

#market-info-box .box-toggle-tab {
    left: 0;
    transform: translateX(-100%);
    width: auto;
    padding: 0 10px;
    gap: 6px;
}

#market-info-box .box-toggle-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

#route-info-box.minimized .box-toggle-tab i,
#market-info-box.minimized .box-toggle-tab i {
    transform: rotate(180deg);
}

#route-info-box::-webkit-scrollbar,
#market-info-box::-webkit-scrollbar {
    width: 6px;
}

#route-info-box::-webkit-scrollbar-thumb,
#market-info-box::-webkit-scrollbar-thumb {
    background-color: #bdc3c7;
    border-radius: 10px;
}

#market-info-box.hidden {
    display: none !important;
}

#market-info-box {
    top: 80px;
    width: var(--market-panel-width);
    /* Same position, usually mutually exclusive or stacked */
    display: block;
    /* Managed by hidden class */
}

#market-info-box.minimized #market-stats-content,
#market-info-box.minimized .close-btn {
    display: none;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #95a5a6;
    cursor: pointer;
    font-size: 1.1rem;
}

.close-btn:hover {
    color: #e74c3c;
}

/* Stats Styling */
.stat-header {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    border-bottom: 1px solid #dfe6e9;
    padding-bottom: 5px;
}

.stat-header-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.stat-header-row .stat-header {
    flex: 1;
}

.market-export-btn {
    font-size: 0.72rem;
    padding: 4px 8px;
    white-space: nowrap;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #34495e;
}

.stat-badge {
    background: #ecf0f1;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #7f8c8d;
}

/* Radius Circle Colors */
.radius-circle-producer {
    stroke: #27ae60;
    fill: #27ae60;
}

.radius-circle-outlet {
    stroke: #3498db;
    fill: #3498db;
}

.route-detail-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.route-icon {
    width: 24px;
    text-align: center;
    margin-right: 10px;
    color: #3498db;
}

.route-info.hidden {
    display: none !important;
}

.route-info .close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #95a5a6;
    font-size: 1.1rem;
    padding: 0;
    width: 20px;
    height: 20px;
    line-height: 20px;
}

.route-info .close-btn:hover {
    color: #e74c3c;
}

.route-detail-row {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.route-icon {
    width: 20px;
    text-align: center;
    color: #3498db;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }


    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- V1 PLATFORM STYLES --- */

/* App Container */
#app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    width: 100%;
    gap: 0;
    overflow: visible; /* allow user dropdown to overflow */
}

/* Navigation Bar */
/* STATS GRID & CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.print-only {
    display: none;
}

.reporting-print-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0 14px;
    border-bottom: 1px solid #eaecef;
    margin-bottom: 16px;
}

.reporting-print-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reporting-print-logo {
    height: 22px;
    width: auto;
}

.reporting-print-title {
    font-weight: 800;
    color: #2c3e50;
    letter-spacing: 0.2px;
}

.reporting-compartment {
    margin-bottom: 22px;
}

.reporting-compartment-header {
    margin: 6px 0 14px;
}

.reporting-compartment-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #2c3e50;
}

.reporting-compartment-header p {
    margin: 6px 0 0;
    color: #6b7b8c;
    font-size: 0.92rem;
}

.economic-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    margin-right: 6px;
    font-size: 0.78rem;
    font-weight: 700;
}

.economic-chip-cost {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.12);
}

.economic-chip-revenue {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.12);
}

.reporting-print-meta {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    text-align: right;
}

.reporting-print-confidential {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #c0392b;
    border: 1px solid rgba(192, 57, 43, 0.25);
    padding: 4px 8px;
    border-radius: 999px;
}

.impact-card {
    padding: 16px;
    border: 1px solid rgba(39, 174, 96, 0.22);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.08), rgba(255, 255, 255, 1) 62%);
}

#impact-text {
    font-size: 1.02rem;
    color: #34495e;
    font-weight: 500;
}

#impact-text .impact-lead {
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 8px;
}

#impact-text .impact-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    text-align: left;
}

#impact-text .impact-equiv-carousel {
    display: flex;
    align-items: center;
    gap: 10px;
}

#impact-text .impact-equiv-carousel .impact-metrics {
    flex: 1;
    min-width: 0;
}

#impact-text .impact-arrow {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e6edf3;
    background: #ffffff;
    color: #34495e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px -6px rgba(0, 0, 0, 0.18);
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

#impact-text .impact-arrow:hover {
    background: #f4f8f5;
    border-color: rgba(39, 174, 96, 0.45);
    color: #27ae60;
    transform: scale(1.07);
}

#impact-text .impact-arrow:active {
    transform: scale(0.95);
}

@keyframes impactEquivFade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: none; }
}

#impact-text .impact-metric {
    animation: impactEquivFade 0.25s ease;
}

#impact-text .impact-metric {
    display: grid;
    grid-template-columns: 84px 1fr;
    align-items: center;
    gap: 12px;
    background: white;
    border: 1px solid #e6edf3;
    padding: 12px;
    border-radius: 12px;
    position: relative;
    min-height: 94px;
}

#impact-text .impact-metric-km {
    border-color: rgba(52, 152, 219, 0.28);
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.09), #ffffff 58%);
}

#impact-text .impact-metric-energy {
    border-color: rgba(39, 174, 96, 0.28);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.09), #ffffff 58%);
}

#impact-text .impact-visual {
    width: 84px;
    height: 66px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #eef2f5;
}

#impact-text .impact-metric-km .impact-visual {
    background: rgba(52, 152, 219, 0.12);
}

#impact-text .impact-metric-energy .impact-visual {
    background: rgba(39, 174, 96, 0.13);
}

#impact-text .impact-illustration {
    width: 72px;
    height: 52px;
    display: block;
}

#impact-text .impact-icon {
    width: 56px;
    height: 56px;
    display: block;
    object-fit: contain;
}

#impact-text .impact-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#impact-text .impact-copy strong {
    font-size: 1.12rem;
    line-height: 1.15;
    color: #1f2d3a;
}

#impact-text .impact-copy span {
    font-size: 0.9rem;
    color: #4f6476;
    line-height: 1.24;
}

#impact-text .impact-explain {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    color: #8ca0b3;
    line-height: 1.4;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #ecf0f1;
}

#impact-text .impact-metric i {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(39, 174, 96, 0.12);
    color: #27ae60;
    flex: 0 0 auto;
}

#impact-text .impact-metric[data-tooltip]:hover {
    border-color: rgba(44, 62, 80, 0.22);
    box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.18);
}

#impact-text .impact-metric[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(100% + 10px);
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.25;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
    z-index: 30;
    white-space: pre-wrap;
}

#impact-text .impact-metric[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    left: 24px;
    bottom: calc(100% + 2px);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(44, 62, 80, 0.95);
    z-index: 31;
}

#impact-text .impact-footnote {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #7f8c8d;
    font-weight: 500;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#impact-text .impact-source-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #27ae60;
    text-decoration: none;
    font-weight: 600;
}

#impact-text .impact-source-link:hover {
    text-decoration: underline;
}

#impact-text .impact-source-logo {
    height: 26px;
    width: auto;
    display: block;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    /* Hide global chrome */
    #main-nav,
    #main-footer,
    #notification-container,
    #side-panel,
    #route-info-box,
    #market-info-box {
        display: none !important;
    }

    /* Show reporting only */
    #map-view,
    #tours-view,
    #invoice-view,
    #profile-view {
        display: none !important;
    }

    #reporting-view {
        display: block !important;
    }

    /* Keep only the printable reporting body */
    #reporting-view .view-header {
        display: none !important;
    }

    body, #app-container {
        background: white !important;
    }

    .print-only {
        display: block !important;
    }

    .reporting-print-header {
        display: flex !important;
        position: static;
        transform: none;
        width: 100%;
        box-sizing: border-box;
        margin: 0 0 12px;
        padding: 0 0 10px;
        max-width: none;
        background: white;
        border-bottom: 1px solid #eaecef;
        border-top: none;
        z-index: 1;
    }

    #reporting-view .container-width {
        max-width: none !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Hide filter UI and print button */
    #toggle-reporting-filters,
    #reporting-print,
    #reporting-filters-panel {
        display: none !important;
    }

    /* Reduce shadows for print */
    .card,
    .stat-card {
        box-shadow: none !important;
    }

    .chart-container {
        break-inside: avoid;
    }

    .reporting-compartment {
        margin: 0 !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    #reporting-economic-compartment,
    #reporting-impact-compartment {
        break-before: page;
        page-break-before: always;
    }

    #reporting-volume-compartment,
    #reporting-economic-compartment,
    #reporting-impact-compartment {
        break-after: auto;
        page-break-after: auto;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 14px;
    }

    .stat-card {
        padding: 12px;
    }

    .chart-container {
        padding: 14px;
        height: 250px;
        margin-bottom: 14px;
    }

    .chart-container canvas {
        min-height: 220px !important;
    }

    #impact-illustration {
        margin-top: 8px !important;
    }
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card.primary {
    border: 1px solid rgba(39, 174, 96, 0.18);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.08), rgba(255, 255, 255, 1) 55%);
}

.stat-card.primary .stat-icon {
    background: rgba(39, 174, 96, 0.16);
}

.stat-card.kpi-cost {
    border: 1px solid rgba(192, 57, 43, 0.18);
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.08), rgba(255, 255, 255, 1) 60%);
}

.stat-card.kpi-cost .stat-icon {
    background: rgba(192, 57, 43, 0.16);
    color: #c0392b;
}

.stat-card.kpi-cost .stat-info h2 {
    color: #c0392b;
}

.stat-card.kpi-revenue {
    border: 1px solid rgba(39, 174, 96, 0.2);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.08), rgba(255, 255, 255, 1) 60%);
}

.stat-card.kpi-revenue .stat-icon {
    background: rgba(39, 174, 96, 0.16);
    color: #27ae60;
}

.stat-card.kpi-revenue .stat-info h2 {
    color: #1f7d44;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info .stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info h2 {
    margin: 5px 0 0 0;
    font-size: 1.6rem;
    color: #2c3e50;
}

/* CHART CONTAINER */
.chart-container {
    padding: 25px;
    margin-bottom: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    height: 420px;
    z-index: 1; /* allow overlays from following cards (ex: tooltips) */
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    min-height: 320px;
}

/* CARD COMPONENT */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Allow reporting "equivalences" tooltips to overlap nearby cards/charts */
#impact-illustration.card {
    overflow: visible;
    position: relative;
    z-index: 2;
}


/* SIDE PANEL */
.side-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 12005; /* under .side-panel (12010), above map/sidebar (12000) */
    opacity: 0;
    pointer-events: none; /* clicks pass through to existing close-on-click-outside handler */
    transition: opacity 0.3s ease;
}

.side-panel-backdrop.open {
    opacity: 1;
    pointer-events: auto; /* capte le clic « en dehors » pour fermer le volet */
}

.side-panel {
    position: fixed;
    top: 0;
    right: -650px;
    width: 600px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 12010; /* keep above nav/header and map */
    transition: right 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
}

.side-panel.open {
    right: 0;
}

/* Navigation précédent / suivant dans le volet détail d'un tour. */
.tour-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.tour-nav-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 9px;
    border: 1px solid #e6edf3;
    background: #fff;
    color: #34495e;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tour-nav-btn:hover:not(:disabled) {
    background: #f4f8f5;
    border-color: rgba(39, 174, 96, 0.4);
    color: #27ae60;
}

.tour-nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Modale documents : navigation Précédent/Suivant de part et d'autre des actions. */
.tour-docs-actions {
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tour-docs-actions .tour-docs-nav-btn {
    flex: 0 0 auto;
}

.tour-docs-actions-center {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Documents déjà téléversés, consultables depuis la modale de saisie. */
.tour-docs-existing {
    margin-bottom: 14px;
}

.tour-docs-existing-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    margin-bottom: 6px;
    border-radius: 9px;
    border: 1px solid #e6edf3;
    background: #f7faf8;
    color: #2c7a4b;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.tour-docs-existing-link:hover {
    background: #eef6f0;
    border-color: rgba(39, 174, 96, 0.45);
}

.tour-docs-existing-link span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tour-docs-existing-ext {
    color: #8ca0b3;
    font-size: 0.78rem;
}

.side-panel-header {
    padding: 20px;
    border-bottom: 1px solid #c9e6d1;
    background: #e7f5ea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.side-panel-header h3 {
    color: #2f7d46;
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 12px;
}

.side-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.details-section {
    margin-bottom: 25px;
}

.details-section h4 {
    border-bottom: 1px solid #f1f2f6;
    padding-bottom: 8px;
    margin-bottom: 12px;
    color: #7f8c8d;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.detail-label {
    color: #95a5a6;
}

.detail-value {
    color: #2c3e50;
    font-weight: 500;
}

/* 3-STATE TOGGLE */
.state-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px;
    font-weight: 600;
}

.state-controls {
    display: flex;
    gap: 4px;
    background: #f1f2f6;
    padding: 2px;
    border-radius: 6px;
}

.btn-state {
    border: none;
    background: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: #95a5a6;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-state.active {
    background: white;
    color: #27ae60;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-state[data-state="hidden"].active {
    color: #e74c3c;
}

/* GISEMENTS TREE */
#gisement-tree.tree-list {
    max-height: 340px;
}

#departments-list {
    border-radius: 8px;
    border: 1px solid #f1f2f6;
    background: #fff;
    padding: 6px;
    margin-top: 0;
    max-height: 220px;
    overflow-y: auto;
}

.departments-search-box {
    margin-bottom: 6px;
}

.department-item {
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #34495e;
}

.department-item:hover {
    background: #f8f9fa;
}

.department-item.selected {
    background: #fff3e6;
    border-left: 3px solid #e67e22;
}

/* Navigation Bar */
/* Navigation Bar Redesign */
#main-nav {
    height: 70px;
    background: white;
    margin: 0;
    border-bottom: 1px solid #f1f2f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.02);
    z-index: 12000; /* above map/sidebar/toggles */
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-logo-img {
    height: 35px;
}

.nav-toggle {
    display: none;
    background: #f4f6f7;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #2c3e50;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-link {
    background: none;
    border: none;
    font-size: 0.95rem;
    color: #7f8c8d;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
    gap: 10px;
    align-items: center;
}

.nav-link i {
    color: inherit;
    margin-right: 8px;
}

.nav-link:hover {
    color: #2c3e50;
    background: #f8f9fa;
}

.nav-link.active {
    color: #27ae60;
    font-weight: 600;
    background: #eafaf1;
}

.nav-link.disabled {
    opacity: 0.6;
    cursor: default;
}

.nav-link.disabled:hover {
    background: none;
    color: #7f8c8d;
}

/* Sous-menu « Outils internes » (admin) — desktop : menu déroulant flottant. */
.nav-tools-container {
    position: relative;
    display: inline-flex;
}
.nav-tools-caret {
    margin-left: 4px;
    font-size: 11px;
}
.nav-tools-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    min-width: 240px;
    z-index: 100;
    padding: 4px 0;
    margin-top: 4px;
}
.nav-tool-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #1f2937;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}
.nav-tool-item:hover {
    background: #f8f9fa;
    color: #27ae60;
}
.nav-tool-item i {
    width: 16px;
    text-align: center;
}
.nav-tools-group-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #9ca3af;
}
.nav-tools-group-label i {
    font-size: 11px;
    color: #27ae60;
    width: auto;
}
.nav-tools-divider {
    height: 1px;
    background: #f0f1f3;
    margin: 4px 0;
}

.badge-soon {
    background: #f39c12;
    color: white;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 4px;
    vertical-align: super;
    margin-left: 2px;
}

/* User Menu & Hamburger */
.user-menu-container {
    position: relative;
    cursor: pointer;
    z-index: 3000; /* keep dropdown above map/sidebar */
}

.user-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-trigger:hover {
    background: #f8f9fa;
}

#nav-user-name {
    font-weight: 600;
    color: #2c3e50;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 18px;
    height: 14px;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: #2c3e50;
    border-radius: 2px;
}

@media (max-width: 900px) {
    #main-nav {
        padding: 0 16px;
        height: 64px;
    }
    .nav-left {
        gap: 12px;
    }
    .nav-logo-img {
        height: 30px;
    }
    .nav-toggle {
        display: flex;
    }
    .nav-links {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 10px 16px;
        gap: 6px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
        display: none;
        z-index: 12000;
    }
    .nav-links.open {
        display: flex;
    }
    .nav-link {
        width: 100%;
        justify-content: flex-start;
    }
    .nav-right {
        position: relative;
        z-index: 12001;
    }

    /* Sous-menu « Outils internes » : intégré dans la colonne du menu mobile
       (pas de boîte flottante), cohérent avec les autres liens empilés. */
    .nav-tools-container {
        display: block;
        width: 100%;
    }
    #nav-link-tools {
        width: 100%;
        justify-content: flex-start;
    }
    .nav-tools-dropdown {
        position: static;
        box-shadow: none;
        border: none;
        border-left: 3px solid #27ae60;
        border-radius: 0;
        min-width: 0;
        margin: 4px 0 4px 16px;
        padding: 2px 0;
        background: #f8f9fa;
    }
    .nav-tool-item {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .side-panel {
        top: 0;
        height: 100vh;
        width: min(96vw, 600px);
    }

    .map-legend-panel.is-pinned {
        left: auto !important;
        right: 12px !important;
        bottom: 84px;
        transform: none;
        max-width: calc(100vw - 24px);
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    /* --- Table des enlèvements : vue carte responsive --- */
    /* Supprime le scroll horizontal et le min-width desktop */
    #tours-view .table-responsive {
        overflow-x: visible;
    }
    #tours-view .data-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0;
    }
    /* Cache l'en-tête et le pied de tableau */
    #tours-view .data-table thead,
    #tours-view .data-table tfoot {
        display: none;
    }
    /* Chaque ligne devient une carte flex */
    #tours-view .data-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 10px 12px 8px;
        border-bottom: 1px solid #f1f2f6;
        gap: 4px 8px;
    }
    #tours-view .data-table tbody tr:last-child {
        border-bottom: none;
    }
    /* Ligne de séparation entre ligne 1 et ligne 2 via ::before */
    #tours-view .data-table tbody tr::before {
        content: '';
        order: 5;
        flex-basis: 100%;
        height: 0;
    }
    /* Reset padding générique pour les cellules */
    #tours-view .data-table tbody td {
        padding: 2px 4px;
        border: none;
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 38vw;
    }
    /* td:1 Réf — ligne 1, gras */
    #tours-view .data-table tbody td:nth-child(1) {
        order: 1;
        font-weight: 700;
        font-size: 0.9rem;
        max-width: none;
    }
    /* td:2 Docs — caché */
    #tours-view .data-table tbody td:nth-child(2) {
        display: none;
    }
    /* td:3 Date — ligne 1 */
    #tours-view .data-table tbody td:nth-child(3) {
        order: 2;
        color: #636e72;
        font-size: 0.82rem;
        max-width: none;
    }
    /* td:4 Statut — ligne 1 */
    #tours-view .data-table tbody td:nth-child(4) {
        order: 3;
        max-width: none;
    }
    /* td:5 Tonnage — ligne 1, poussé à droite */
    #tours-view .data-table tbody td:nth-child(5) {
        order: 4;
        margin-left: auto;
        font-weight: 700;
        font-size: 0.88rem;
        max-width: none;
    }
    /* td:6 Matière — ligne 1, à la suite du statut */
    #tours-view .data-table tbody td:nth-child(6) {
        order: 3;
        color: #636e72;
        font-size: 0.8rem;
        max-width: 40vw;
    }
    /* td:7 Producteur — ligne 2 */
    #tours-view .data-table tbody td:nth-child(7) {
        order: 6;
        flex: 1 1 28%;
        color: #636e72;
        font-size: 0.8rem;
    }
    /* td:8 Transporteur — ligne 2 */
    #tours-view .data-table tbody td:nth-child(8) {
        order: 7;
        flex: 1 1 28%;
        color: #636e72;
        font-size: 0.8rem;
    }
    /* td:9 Débouché — ligne 2 */
    #tours-view .data-table tbody td:nth-child(9) {
        order: 8;
        flex: 1 1 28%;
        color: #636e72;
        font-size: 0.8rem;
    }
    /* td:10 Distance — cachée */
    #tours-view .data-table tbody td:nth-child(10) {
        display: none;
    }
    /* td:11 Chevron — ligne 2, poussé à droite */
    #tours-view .data-table tbody td:nth-child(11) {
        order: 9;
        margin-left: auto;
        max-width: none;
    }

}

/* Dropdown */
.user-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    width: 200px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f2f6;
    padding: 10px 0;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
    z-index: 3001;
}

.user-dropdown.hidden {
    display: none !important; /* ensure hidden even with map layers */
}

.user-dropdown a {
    display: block;
    padding: 10px 20px;
    color: #34495e;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.1s;
}

.user-dropdown a:hover {
    background: #f8f9fa;
    color: #27ae60;
}

.dropdown-divider {
    height: 1px;
    background: #f1f2f6;
    margin: 5px 0;
}

/* Footer Style */
#main-footer {
    height: 40px;
    background: #fff;
    border-top: 1px solid #f1f2f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
    font-size: 0.8rem;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
}

.footer-content {
    display: flex;
    gap: 15px;
    align-items: center;
    width: 100%;
    justify-content: center;
    position: relative;
}

.footer-role {
    position: absolute;
    right: 20px;
    color: #bdc3c7;
    font-size: 0.75rem;
}

.footer-version {
    position: absolute;
    left: 20px;
    color: #bdc3c7;
    font-size: 0.7rem;
    cursor: help;
}

.footer-role.footer-role-admin {
    cursor: pointer;
    text-decoration: none;
}

.footer-role.footer-role-admin:hover {
    color: #2ecc71;
}

/* Admin Modal */
#admin-modal .modal-content {
    max-width: 1100px;
    width: 85vw;
    max-height: 70vh;
    min-height: 420px;
    display: flex;
    flex-direction: column;
}

#admin-modal .modal-content > h3 {
    flex: 0 0 auto;
}

#admin-modal .modal-content > .modal-actions {
    flex: 0 0 auto;
}

.admin-modal-page {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #2c3e50;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.admin-modal-section h4 {
    margin: 12px 0 8px;
    font-size: 0.95rem;
    color: #34495e;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 4px;
}

.admin-modal-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-modal-links li {
    padding: 6px 0;
}

.admin-modal-links a {
    color: #2c7a7b;
    text-decoration: none;
}

.admin-modal-links a:hover {
    text-decoration: underline;
}

.admin-modal-back {
    margin-bottom: 10px;
}

.btn-link {
    background: none;
    border: none;
    color: #2c7a7b;
    cursor: pointer;
    padding: 0;
    font-size: 0.88rem;
}

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

.admin-dq-status {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.admin-dq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-dq-group {
    border: 1px solid #ecf0f1;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.admin-dq-group[open] {
    background: #fafbfc;
}

.admin-dq-group-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
    list-style: none;
    user-select: none;
}

.admin-dq-group-summary::-webkit-details-marker {
    display: none;
}

.admin-dq-group-summary::before {
    content: "▸";
    display: inline-block;
    color: #7f8c8d;
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}

.admin-dq-group[open] > .admin-dq-group-summary::before {
    transform: rotate(90deg);
}

.admin-dq-group-title {
    flex: 1;
}

.admin-dq-group-count {
    background: #e74c3c;
    color: #fff;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 22px;
    text-align: center;
}

.admin-dq-group-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 10px 10px;
}

.admin-dq-item {
    border: 1px solid #ecf0f1;
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
}

.admin-dq-item-main {
    min-width: 0;
}

.admin-dq-item-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
}

.admin-dq-item-sub {
    color: #7f8c8d;
    font-size: 0.8rem;
}

.admin-dq-item-desc {
    color: #34495e;
    font-size: 0.82rem;
    margin-top: 4px;
}

.admin-dq-item-link {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-dq-link {
    display: inline-block;
    background: #e8f4f4;
    color: #2c7a7b;
    border: 1px solid #b8d9d9;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.82rem;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
}

.btn-dq-link:hover {
    background: #d1e8e8;
    text-decoration: none;
}

.admin-dq-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.admin-dq-item-actions .btn-resolve {
    background: #ecf0f1;
    color: #2c3e50;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78rem;
}

.admin-dq-item-actions .btn-resolve:hover {
    background: #d5dbdb;
}

.admin-dq-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.admin-dq-toolbar.hidden {
    display: none;
}

.admin-dq-search {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid #d5dbdb;
    border-radius: 4px;
    font-size: 0.82rem;
    color: #2c3e50;
}

.admin-dq-search:focus {
    outline: none;
    border-color: #27ae60;
}

.btn-dq-resolve-all {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
}

.btn-dq-resolve-all:hover {
    background: #c0392b;
}

.btn-dq-resolve-all:disabled {
    opacity: 0.6;
    cursor: default;
}

.admin-dq-group-actions {
    display: flex;
    justify-content: flex-end;
    padding: 8px 14px 0;
}

.btn-resolve-group {
    background: #f5b7b1;
    color: #7b241c;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 600;
}

.btn-resolve-group:hover {
    background: #f1948a;
}

.btn-resolve-group:disabled {
    opacity: 0.6;
    cursor: default;
}

.admin-dq-empty {
    color: #7f8c8d;
    font-style: italic;
    padding: 20px;
    text-align: center;
}


/* Dashboard Views */
.dashboard-view {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding-bottom: 40px;
    animation: fadeIn 0.4s ease;
}

.container-width {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 20px 20px;
}

.view-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-subview {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.view-header h1 {
    font-size: 1.8rem;
    color: #2d3436;
}

/* Filters Bar */
.filters-bar {
    background: white;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid #f1f2f6;
}

.filter-input-search {
    flex: 1;
    min-width: 200px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid #dfe6e9;
}

.filters-bar select,
.filters-bar input {
    padding: 10px 14px;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-family: inherit;
    color: #2c3e50;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.filters-bar select:focus,
.filters-bar input:focus {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

.btn-export {
    background: #f8f9fa;
    color: #34495e;
    border: 1px solid #dfe6e9;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-export:hover {
    background: #fff;
    border-color: #27ae60;
    color: #27ae60;
}

/* Data Tables */
.table-responsive {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    /* Force scroll on small screens */
}

.data-table th,
.data-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid #f1f2f6;
}

.data-table th {
    background: #fbfbfb;
    font-weight: 600;
    color: #636e72;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 0.95rem;
    color: #2d3436;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: #fdfdfd;
}

/* Invoice Tables Specific Styling */
#invoices-table-body tr,
#purchase-orders-table-body tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

#invoices-table-body tr:hover,
#purchase-orders-table-body tr:hover {
    background: #f8f9fa;
}

#invoices-table-body tr:hover .fa-chevron-right,
#purchase-orders-table-body tr:hover .fa-chevron-right {
    color: #27ae60;
}

/* Ensure invoice table columns fit on laptop screens */
#invoice-view .data-table {
    min-width: auto;
}

#invoice-view .data-table th,
#invoice-view .data-table td {
    padding: 12px 15px;
    white-space: nowrap;
}

#invoice-view .data-table th:first-child,
#invoice-view .data-table td:first-child {
    width: 140px;
    /* Numéro column */
}

#invoice-view .data-table th:nth-child(2),
#invoice-view .data-table td:nth-child(2) {
    width: 120px;
    /* Status column */
}

#invoice-view .data-table th:nth-child(3),
#invoice-view .data-table td:nth-child(3) {
    width: 100px;
    /* Date column */
}

#invoice-view .data-table th:nth-child(4),
#invoice-view .data-table td:nth-child(4) {
    width: 110px;
    /* Total HT */
}

#invoice-view .data-table th:nth-child(5),
#invoice-view .data-table td:nth-child(5) {
    width: auto;
    /* Total TTC with arrow */
}


/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.tour-aplanifier {
    background: #f7d7dd;
    color: #8b2634;
}

.status-badge.tour-confirme {
    background: #d8ebff;
    color: #285f96;
}

.status-badge.tour-validation {
    background: #ffe9b3;
    color: #9a6700;
}

.status-badge.tour-realise {
    background: #d9f2e1;
    color: #1f7441;
}

.status-badge.tour-annule {
    background: #a92e3b;
    color: #ffffff;
}

.status-badge.tour-attente-retour {
    background: #ffe3bf;
    color: #9b4b00;
}

.status-badge.tour-demande {
    background: #ffe3bf;
    color: #9b4b00;
}

.status-badge.demande,
.status-badge.planifie,
.status-badge.planifié {
    background: #f7d7dd;
    color: #8b2634;
}

.status-badge.confirme {
    background: #d8ebff;
    color: #285f96;
}

.status-badge.realise {
    background: #d9f2e1;
    color: #1f7441;
}

.status-badge.annulee,
.status-badge.annule {
    background: #a92e3b;
    color: #ffffff;
}

/* Invoice/Purchase Order Status Badges (buckets normalises) */
/* Brouillon */
#invoice-view .status-badge.doc-draft {
    background: #dfe6e9;
    color: #636e72;
}

/* En attente de paiement */
#invoice-view .status-badge.doc-pending {
    background: #ffeaa7;
    color: #d35400;
}

/* Payé(e) */
#invoice-view .status-badge.doc-paid {
    background: #a8e6cf;
    color: #27ae60;
}

/* En retard de paiement */
#invoice-view .status-badge.doc-overdue {
    background: #ffcccc;
    color: #e74c3c;
}

/* Valeur inconnue / non mappee (ex. statuts BDC bruts) */
#invoice-view .status-badge.doc-unknown {
    background: #ecf0f1;
    color: #7f8c8d;
}

/* --- Onglets de la vue Documents (Factures / Bons de Commande) --- */
.documents-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #edf2f7;
}

.doc-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #718096;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    transition: all 0.2s;
}

.doc-tab:hover {
    color: #2d3748;
    background: #f7fafc;
}

.doc-tab-count {
    background: #e2e8f0;
    color: #4a5568;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

/* Onglet Factures actif -> accent vert (couleur de la carte Factures). */
.doc-tab-invoices.active {
    color: #27ae60;
    border-bottom-color: #27ae60;
}

.doc-tab-invoices.active .doc-tab-count {
    background: #27ae60;
    color: #fff;
}

/* Onglet Bons de Commande actif -> accent bleu nuit (couleur de la carte BDC). */
.doc-tab-purchase-orders.active {
    color: #2c3e50;
    border-bottom-color: #2c3e50;
}

.doc-tab-purchase-orders.active .doc-tab-count {
    background: #2c3e50;
    color: #fff;
}

/* Tours rattachés (volet détail document) — chips cliquables */
.doc-tour-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.doc-tour-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #d6e4ff;
    border-radius: 20px;
    background: #eef4ff;
    color: #285f96;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.doc-tour-chip:hover {
    background: #d8ebff;
    border-color: #aecbff;
}

.doc-tour-chip:active {
    transform: scale(0.97);
}

.doc-tour-chip i {
    font-size: 0.75rem;
    opacity: 0.8;
}


/* Buttons */
.btn-primary {
    background: #27ae60;
    color: white;
    border: none;
    /* Sans border-box, les boutons en width:100% (liens documents du volet) débordent
       de la largeur du padding et provoquent un scroll horizontal disgracieux. */
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: #219150;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(39, 174, 96, 0.2);
}

.btn-primary.btn-documents-alert {
    background: #c0392b;
}

.btn-primary.btn-documents-alert:hover {
    background: #a93226;
    box-shadow: 0 4px 10px rgba(192, 57, 43, 0.24);
}

.btn-primary.btn-documents-alert.btn-documents-alert-saved {
    background: #e67e22;
}

.btn-primary.btn-documents-alert.btn-documents-alert-saved:hover {
    background: #d35400;
    box-shadow: 0 4px 10px rgba(230, 126, 34, 0.24);
}

.btn-secondary {
    background: #eee;
    color: #636e72;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #dfe6e9;
    color: #2d3436;
}

.btn-export {
    background: #fff;
    border: 1px solid #dfe6e9;
    color: #2c3e50;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-export:hover {
    border-color: #27ae60;
    color: #27ae60;
}

.btn-export-wrapper {
    display: inline-flex;
}

.btn-export:disabled,
.btn-export[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: #dfe6e9;
    color: #95a5a6;
    background: #f2f4f6;
    box-shadow: none;
    transform: none;
}

.btn-export:disabled:hover,
.btn-export[aria-disabled="true"]:hover {
    border-color: #dfe6e9;
    color: #95a5a6;
    background: #f2f4f6;
}

.login-error {
    background: #ffe6e6;
    color: #e74c3c;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 15px;
    display: none;
    /* Hidden by default */
    border: 1px solid #fab1a0;
}

/* Bouton flottant (FAB) – demande d'enlèvement pour les producteurs.
   bottom: footer (40px) + marge confortable (36px) = 76px.
   right: 48px pour rester légèrement éloigné du bord droit. */
.btn-fab {
    position: fixed;
    bottom: 76px;
    right: 48px;
    z-index: 9000; /* sous les modals (10000+) mais au-dessus de tout le reste */
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #27ae60;
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(39, 174, 96, 0.45);
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn-fab:hover {
    background: #219150;
    transform: scale(1.07);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.55);
}
.btn-fab.hidden {
    display: none !important;
}
/* Label texte : caché sur mobile/tablette, visible sur desktop */
.fab-label {
    display: none;
}
@media (min-width: 769px) {
    .fab-label {
        display: inline;
        font-size: 0.88rem;
        font-weight: 600;
        white-space: nowrap;
        letter-spacing: 0.01em;
    }
    .btn-fab {
        width: auto;
        height: 50px;
        border-radius: 25px;
        padding: 0 20px 0 16px;
        gap: 10px;
    }
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(44, 62, 80, 0.6);
    backdrop-filter: blur(4px);
    z-index: 12050; /* au-dessus du volet latéral (12010) et de son backdrop (12005) */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.modal.hidden {
    display: none !important;
    /* Force override flex */
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.modal-content label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #636e72;
    font-weight: 500;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.95rem;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
    border-color: #27ae60;
    outline: none;
}

#tour-documents-modal {
    z-index: 14040;
}

#actor-info-modal {
    z-index: 14050;
}

#actor-info-modal .modal-content {
    max-width: 840px;
}

#tour-documents-modal .modal-content {
    max-width: 620px;
}

#tour-docs-comment {
    min-height: 88px;
    resize: vertical;
}

#tour-docs-split-weights.hidden {
    display: none !important;
}

#tour-docs-retained-weight.input-disabled {
    background: #f2f4f6;
    color: #8a97a5;
    cursor: not-allowed;
}

.upload-files-list {
    margin: -6px 0 12px;
    font-size: 0.85rem;
    color: #5f6c7b;
}

.upload-files-list .file-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px;
    border: 1px solid #e8edf2;
    border-radius: 6px;
    margin-top: 6px;
    background: #f9fbfd;
}

.crossing-meta {
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #2c3e50;
    line-height: 1.4;
    word-break: break-word;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.release-modal-actions {
    justify-content: space-between;
    align-items: center;
}

.release-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.release-nav-btn {
    padding: 8px 10px;
    min-width: 40px;
    text-align: center;
}

.release-nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.release-nav-status {
    color: #95a5a6;
    font-size: 0.85rem;
    min-width: 110px;
    text-align: center;
}

/* Table Summary */
tfoot {
    background: #f9f9f9;
    border-top: 2px solid #dfe6e9;
}

.summary-row td {
    padding: 12px 15px;
    color: #2c3e50;
    font-size: 0.9rem;
}

#tours-view .data-table th:nth-child(1),
#tours-view .data-table td:nth-child(1) {
    min-width: 50px;
    white-space: nowrap;
}

#tours-view .data-table th:nth-child(4),
#tours-view .data-table td:nth-child(4) {
    min-width: 140px;
    white-space: nowrap;
}

/* Liste des enlèvements : police légèrement plus petite et cellules resserrées
   pour laisser de la place à la colonne Matière. */
#tours-view .data-table th,
#tours-view .data-table td {
    padding: 11px 12px;
}
#tours-view .data-table td {
    font-size: 0.86rem;
}
#tours-view .data-table th {
    font-size: 0.78rem;
    letter-spacing: 0.3px;
}
/* td:6 Matière — tronquée avec ellipsis pour ne pas trop élargir la colonne */
#tours-view .data-table td.tour-matiere-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-input-label {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e8f3ff;
    color: #2568a6;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.2px;
    cursor: pointer;
}

.tonnage-theoretical-asterisk {
    margin-left: 3px;
    color: #7f8c8d;
    font-weight: 700;
}

/* Surbrillance verte temporaire après création d'un nouveau tour */
@keyframes highlight-new-tour {
    0%   { background: #d4f5e2; }
    70%  { background: #d4f5e2; }
    100% { background: transparent; }
}
.tour-row-highlight-new {
    animation: highlight-new-tour 3s ease-out forwards;
}

.tour-row-chevron {
    text-align: right;
    color: #95a5a6;
    width: 26px;
}

.tour-row-chevron i {
    font-size: 0.8rem;
}

/* Bouton d'action dans la ligne d'enlèvement (transporteur : répondre sur l'horaire). */
.tour-row-action {
    text-align: right;
    white-space: nowrap;
}

.btn-row-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #d9a441, #e9b75a);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 6px -2px rgba(217, 164, 65, 0.7);
    transition: filter 0.15s, transform 0.05s;
}

.btn-row-action:hover {
    filter: brightness(1.05);
}

.btn-row-action:active {
    transform: translateY(1px);
}


.btn-weight-entry-inline {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: #e74c3c;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    white-space: normal;
    line-height: 1.2;
    max-width: 90px;
    text-align: center;
}

.btn-weight-entry-inline:hover {
    background: #c0392b;
}

.btn-weight-entry-inline i {
    margin-right: 3px;
}

.btn-weight-entry-inline.btn-weight-entry-saved {
    background: #fff;
    color: #e67e22;
    border: 1px solid #e67e22;
    max-width: 140px;
}

.btn-weight-entry-inline.btn-weight-entry-saved:hover {
    background: #fff7f0;
}

.tour-doc-link {
    display: inline-block;
    color: #2c3e50;
    text-decoration: none;
    margin-right: 8px;
    line-height: 1;
    transition: color 0.15s, transform 0.15s;
}

.tour-doc-link i {
    font-size: 1.3rem;
}

.tour-doc-link:hover {
    color: #27ae60;
    transform: scale(1.1);
}

.actor-info-trigger {
    margin-top: 0;
    padding: 6px 10px;
    font-size: 0.82rem;
}

.actor-inline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.actor-inline-name {
    color: #2c3e50;
    font-weight: 600;
    text-transform: uppercase;
}

/* Cards for Mobile (Transporter) */
.card-list {
    display: grid;
    gap: 15px;
}

.mission-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border-left: 5px solid #bdc3c7;
}

.mission-card.blue {
    border-left-color: #3498db;
}

.mission-card.green {
    border-left-color: #27ae60;
}

.mission-card.orange {
    border-left-color: #e67e22;
}

.mission-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
}

.mission-details div {
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #636e72;
}

.mission-details i {
    width: 20px;
    text-align: center;
    color: #95a5a6;
}

.mission-actions {
    margin-top: 15px;
    border-top: 1px solid #f1f2f6;
    padding-top: 10px;
    text-align: right;
}

/* Helper */
.hidden {
    display: none !important;
}

.login-logo {
    height: 40px;
    margin-bottom: 15px;
}

.radius-handle {
    background: white;
    border: 2px solid #27ae60;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: grab;
}

.radius-handle:active {
    cursor: grabbing;
}

.radius-tooltip {
    background: rgba(44, 62, 80, 0.9);
    border: none !important;
    border-radius: 4px;
    color: white !important;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 2px 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.radius-tooltip::before {
    display: none !important;
}

/* --- Collapsible Filters --- */
.collapsible-filters {
    max-height: 500px;
    overflow: visible;
    /* Changed from hidden to allow dropdowns to show */
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin 0.3s ease;
    opacity: 1;
}

.collapsible-filters.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
    overflow: hidden;
    /* Keep hidden when collapsed */
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

/* --- Custom Multiselect --- */
.custom-multiselect {
    position: relative;
    width: 220px;
}

.multiselect-trigger {
    width: 100%;
    padding: 8px 12px;
    background: white !important;
    border: 1px solid #dfe6e9 !important;
    border-radius: 6px;
    text-align: left;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #2c3e50;
}

.multiselect-trigger:hover {
    border-color: #27ae60 !important;
}

.multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    margin-top: 5px;
    padding: 10px;
    width: 280px;
}

.multiselect-dropdown.hidden {
    display: none;
}

.multiselect-search input {
    width: 100% !important;
    box-sizing: border-box;
    padding: 6px 10px !important;
    border: 1px solid #f1f2f6 !important;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    text-align: left !important;
}

.multiselect-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.multiselect-actions button {
    font-size: 0.75rem;
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    padding: 0;
}

.multiselect-actions button:hover {
    text-decoration: underline;
}

.multiselect-options {
    max-height: 200px;
    overflow-y: auto;
}

.multiselect-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-size: 0.85rem;
    cursor: pointer;
}

.multiselect-options label:hover {
    background: #f8f9fa;
}

/* --- Details Panel Groupings --- */
.details-section h4 {
    border-bottom: 2px solid #f1f2f6;
    padding-bottom: 5px;
    margin-top: 25px;
    margin-bottom: 15px;
    color: #27ae60;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #7f8c8d;
    margin: 15px 0 5px 0;
    padding-left: 5px;
}

.sub-details {
    padding-left: 10px;
    border-left: 2px solid #ecf0f1;
    margin-bottom: 15px;
}

.env-impact {
    background: #f1f8f6;
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
}

.env-impact .detail-row {
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.co2-badge {
    color: #e67e22;
    font-weight: 600;
}

/* --- General Adjustments --- */

/* --- New Filter Layout --- */
.filter-action-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 0;
    margin-bottom: 5px;
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-action-bar .filter-input-search {
    flex: 1;
    max-width: none;
    margin-bottom: 0 !important;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #2c3e50;
    transition: all 0.2s;
    background: transparent;
}

.filter-action-bar .filter-input-search:focus {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
    outline: none;
}

.search-input-wrapper {
    position: relative;
    flex: 0 1 280px;
    margin-right: 30px;
}

.search-input-wrapper .filter-input-search {
    width: 100%;
    max-width: none;
}

.search-hint {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 2px;
    font-size: 0.75rem;
    color: #e67e22;
    padding: 2px 0;
    white-space: nowrap;
    pointer-events: none;
    animation: searchHintFadeIn 0.15s ease;
}

@keyframes searchHintFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.btn-filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #4a5568;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-filter-toggle:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.btn-filter-toggle.active {
    background: #ebf8ff;
    border-color: #3182ce;
    color: #2b6cb0;
}

.btn-filter-toggle i {
    font-size: 0.9rem;
}

.active-filters-badge {
    background: #3182ce;
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.collapsible-filters {
    background: white;
    padding: 0 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: visible;
    /* Allow dropdowns to show */
    transition: all 0.3s ease;
}

.collapsible-filters.collapsed {
    max-height: 0;
    margin-top: 0;
    padding: 0 20px;
    opacity: 0;
    pointer-events: none;
    box-shadow: none;
    border: none;
    overflow: hidden;
    /* Hide when collapsed */
}

.collapsible-filters:not(.collapsed) {
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #edf2f7;
}

/* Profile helpers */
.chip {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #ecf0f1;
    color: #34495e;
    font-size: 0.85rem;
    margin: 3px 6px 3px 0;
}

/* Les champs du profil ont width:100% + padding inline : sans border-box ils
   debordent de leur conteneur et les inputs Prenom/Nom finissent par se toucher. */
#profile-form input {
    box-sizing: border-box;
}

/* Types d'e-mails reçus : liste de cases à cocher éditables. */
.profile-mail-types {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mail-pref-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.92rem;
    color: #2c3e50;
    transition: background 0.12s;
}
.mail-pref-option:hover {
    background: #eef2f4;
}
.mail-pref-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #27ae60;
    cursor: pointer;
    flex-shrink: 0;
}

.company-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #edf2f4;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 8px;
}

.company-title {
    font-weight: 600;
    color: #2c3e50;
}

.company-id {
    font-size: 0.8rem;
    color: #95a5a6;
}

/* --- Sticky header (titre + filtres + bouton exporter) sur la vue Enlèvements --- */

/* Donne une hauteur viewport explicite à #tours-view pour que #admin-list-container
   (flex:1; overflow-y:auto) devienne un vrai conteneur de scroll. Sinon body scrolle
   et position:sticky à l'intérieur n'agit pas. */
#tours-view {
    height: calc(100vh - 70px) !important;
    flex: none !important;
}

/* On supprime le padding-top du conteneur de scroll : sans cela, la zone de
   padding (20px) reste visible au-dessus de l'élément sticky pendant le scroll
   et les lignes du tableau y défilent visiblement. Le padding-top est déplacé
   à l'intérieur du wrapper sticky. */
#tours-view #admin-list-container.container-width {
    padding-top: 0;
}

#tours-view .tours-sticky-top {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #f8f9fa;
    /* étend le fond jusqu'aux bords du conteneur pour masquer le contenu qui défile dessous */
    margin: 0 -20px;
    padding: 20px 20px 0;
}

/* Réduit la marge du bandeau pour un rendu compact quand stické */
#tours-view .tours-sticky-top .view-header {
    margin-bottom: 15px;
}

/* Quand les filtres sont ouverts, garder une marge avant le tableau */
#tours-view .tours-sticky-top .collapsible-filters:not(.collapsed) {
    margin-bottom: 15px;
}

/* En-tête de tableau (thead) sticky juste sous le bandeau ; la variable
   --tours-sticky-height est mise à jour en JS selon l'état des filtres. */
#tours-view .table-responsive {
    overflow: visible;
}
#tours-view .data-table thead th {
    position: sticky;
    /* on remonte le thead de 1px pour chevaucher le bandeau et éviter qu'une
       fente sub-pixel laisse apparaître les lignes qui défilent dessous */
    top: calc(var(--tours-sticky-height, 0px) - 1px);
    background: #fbfbfb;
    z-index: 40;
    /* border-collapse efface la bordure-bas du thead quand stické : on la
       reproduit en box-shadow pour qu'elle reste visible pendant le scroll */
    box-shadow: inset 0 -1px 0 #f1f2f6;
}

@media (max-width: 900px) {
    #tours-view {
        height: calc(100vh - 64px) !important;
    }
}

/* ====== Onboarding Shepherd.js — habillage Greenr ====== */
.shepherd-modal-overlay-container {
    z-index: 14060; /* au-dessus des modals (14050) */
}

.shepherd-element.greenr-onboarding-step {
    z-index: 14070;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(44, 62, 80, 0.25);
    max-width: 420px;
    font-family: inherit;
}

.shepherd-element.greenr-onboarding-step .shepherd-header {
    background: #e7f5ea;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    padding: 14px 18px;
}

.shepherd-element.greenr-onboarding-step .shepherd-title {
    color: #2f7d46;
    font-weight: 700;
    font-size: 1rem;
}

.shepherd-element.greenr-onboarding-step .shepherd-text {
    padding: 16px 18px;
    color: #2c3e50;
    font-size: 0.92rem;
    line-height: 1.5;
}

.shepherd-element.greenr-onboarding-step .shepherd-text p {
    margin: 0 0 10px 0;
}

.shepherd-element.greenr-onboarding-step .shepherd-text p:last-child {
    margin-bottom: 0;
}

.shepherd-element.greenr-onboarding-step .shepherd-footer {
    padding: 10px 18px 16px;
    gap: 8px;
}

.shepherd-element.greenr-onboarding-step .shepherd-button {
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 8px 16px;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.shepherd-element.greenr-onboarding-step .shepherd-button-primary {
    background: #27ae60;
    color: #fff;
}
.shepherd-element.greenr-onboarding-step .shepherd-button-primary:hover {
    background: #219150;
}

.shepherd-element.greenr-onboarding-step .shepherd-button-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}
.shepherd-element.greenr-onboarding-step .shepherd-button-secondary:hover {
    background: #dfe6e9;
}

.shepherd-element.greenr-onboarding-step .shepherd-button-link {
    background: transparent;
    color: #7f8c8d;
    padding: 8px 10px;
    text-decoration: underline;
}
.shepherd-element.greenr-onboarding-step .shepherd-button-link:hover {
    color: #2c3e50;
}

.shepherd-element.greenr-onboarding-step .shepherd-cancel-icon {
    color: #95a5a6;
    font-size: 1.2rem;
}
.shepherd-element.greenr-onboarding-step .shepherd-cancel-icon:hover {
    color: #2c3e50;
}

.shepherd-element.greenr-onboarding-step .shepherd-arrow:before {
    background: #fff;
}

/* ============================================================================
   BANDEAU STAGING
   Le staging partage la base ET l'Airtable de production : rien d'autre que ce
   bandeau ne distingue les deux environnements à l'écran. Il ne protège de rien,
   il prévient — d'où le rouge franc, et l'absence de bouton pour le fermer.
   Il se place AU-DESSUS du bandeau d'impersonation, qu'il peut donc doubler.
   ========================================================================= */
#staging-banner {
    position: sticky;
    top: 0;
    z-index: 1200; /* au-dessus de l'impersonation (1100) */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 9px 16px;
    background: #b91c1c;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.35;
}
#staging-banner.hidden {
    display: none;
}
#staging-banner strong {
    font-weight: 800;
    letter-spacing: 0.02em;
}
#staging-banner i {
    font-size: 1.05rem;
    flex-shrink: 0;
}
@media (max-width: 640px) {
    #staging-banner { font-size: 0.82rem; padding: 8px 12px; }
}

/* ============================================================================
   IMPERSONATION (admin)
   Cf. docs/superpowers/specs/2026-06-01-admin-impersonation-design.md
   ========================================================================= */
#impersonation-banner {
    position: sticky;
    top: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 16px;
    background: linear-gradient(90deg, #fff7e6 0%, #ffe9c2 100%);
    color: #6b3d00;
    border-bottom: 1px solid #f2c97d;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
#impersonation-banner.hidden {
    display: none;
}
#impersonation-banner i.fa-user-secret {
    font-size: 1.1rem;
}
#impersonation-banner strong {
    color: #4a2a00;
    font-weight: 700;
}
.impersonation-exit-btn {
    background: #6b3d00;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.impersonation-exit-btn:hover {
    background: #4a2a00;
}
.impersonation-exit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Modale de recherche d'entreprise */
.impersonate-kind {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 7px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 6px;
}
.impersonate-kind-user {
    background: #eef2ff;
    color: #4f46e5;
}
.impersonate-kind-entity {
    background: #ecfdf5;
    color: #047857;
}
.impersonate-row-sub {
    color: #7f8c8d;
    font-size: 0.8rem;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.impersonate-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    background: #fff;
}
.impersonate-row:last-child {
    border-bottom: none;
}
.impersonate-row:hover {
    background: #f6f9fb;
}
.impersonate-row-main {
    flex: 1;
    min-width: 0;
}
.impersonate-row-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}
.impersonate-row-meta {
    color: #7f8c8d;
    font-size: 0.8rem;
    margin-top: 2px;
}
.impersonate-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.impersonate-badge.type-producer {
    background: #e8f5e9;
    color: #2e7d32;
}
.impersonate-badge.type-outlet {
    background: #e3f2fd;
    color: #1565c0;
}
.impersonate-badge.type-transporter {
    background: #fff3e0;
    color: #ef6c00;
}
.impersonate-badge.type-unknown {
    background: #eceff1;
    color: #607d8b;
}
.impersonate-pick-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ============================================================================
   COPRODUITS (fiches techniques des gisements)
   Cf. docs/superpowers/specs/2026-06-01-matieres-fiches-design.md
   ========================================================================= */
.coproducts-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #eef1f3;
    margin: 8px 0 4px;
}

.coproducts-tabs.hidden {
    display: none;
}

.coproducts-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.coproducts-tab:hover {
    color: #2c3e50;
}

.coproducts-tab.active {
    color: #27ae60;
    border-bottom-color: #27ae60;
}

.coproducts-tab-count {
    color: #95a5a6;
    font-weight: 600;
}

.coproducts-tab.active .coproducts-tab-count {
    color: #27ae60;
}

.coproducts-status {
    margin: 16px 0;
    color: #7f8c8d;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}
.coproducts-empty {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #dfe4ea;
}
.coproducts-grid {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.coproducts-section + .coproducts-section {
    margin-top: 4px;
}
.coproducts-section-title {
    margin: 0 0 12px;
    font-size: 1.05rem;
    color: #1f2937;
    font-weight: 700;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}
.coproducts-section-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.coproduct-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow .15s ease, transform .15s ease;
}
.coproduct-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}
.coproduct-photo {
    height: 140px;
    background-size: cover;
    background-position: center;
    background-color: #f3f4f6;
}
.coproduct-photo.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 2rem;
    background-image: none;
}
.coproduct-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.coproduct-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.coproduct-titles {
    flex: 1;
    min-width: 0;
}
.coproduct-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
}
.coproduct-producer {
    margin-top: 2px;
    font-size: 0.82rem;
    color: #6b7280;
}
.coproduct-direction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}
.coproduct-direction.outgoing {
    background: #fff3e0;
    color: #b45309;
}
.coproduct-direction.incoming {
    background: #e3f2fd;
    color: #1565c0;
}
.coproduct-header-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.coproduct-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}
.coproduct-status.active {
    background: #e8f5e9;
    color: #2e7d32;
}
.coproduct-status.study {
    background: #fff8e1;
    color: #a16207;
}
.coproduct-status.inactive {
    background: #f3f4f6;
    color: #6b7280;
}
.coproduct-rows {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.coproduct-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.88rem;
}
.coproduct-row dt {
    color: #6b7280;
    font-weight: 500;
}
.coproduct-row dd {
    margin: 0;
    color: #1f2937;
    font-weight: 600;
    text-align: right;
}
.coproduct-durable {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    width: max-content;
}

/* ─── Alerte réception (débouché) ─────────────────────────────────────────── */
/* Bloc « confirmer / demander un changement d'horaire » (volet détail tour). */
.tour-schedule-actions {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #f0e2c4;
    border-radius: 10px;
    background: linear-gradient(135deg, #fffaf0, #ffffff 80%);
}

.tour-schedule-hint {
    font-weight: 700;
    color: #8a6d1b;
    font-size: 0.92rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tour-schedule-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-schedule-confirm,
.btn-schedule-change {
    flex: 1 1 0;
    min-width: 150px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
}

.btn-schedule-confirm {
    border: 1px solid #27ae60;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff;
}

.btn-schedule-confirm:hover {
    box-shadow: 0 8px 18px -10px rgba(39, 174, 96, 0.7);
}

.btn-schedule-change {
    border: 1px solid #d9a441;
    background: #fff;
    color: #b9770e;
}

.btn-schedule-change:hover {
    background: #fdf6e3;
    box-shadow: 0 8px 18px -10px rgba(217, 164, 65, 0.6);
}

.btn-schedule-confirm:active,
.btn-schedule-change:active {
    transform: translateY(1px);
}

.btn-reception-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 10px;
    border: 1px solid #e67e22;
    background: linear-gradient(135deg, #fff5ec, #ffffff 70%);
    color: #c0560e;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
}

.btn-reception-alert:hover {
    background: linear-gradient(135deg, #fdebd9, #ffffff 75%);
    box-shadow: 0 8px 18px -10px rgba(230, 126, 34, 0.6);
}

.btn-reception-alert:active {
    transform: translateY(1px);
}

/* Au-delà de 48h : bouton visible mais inactif (pas d'attribut `disabled` afin
   que le survol/clic restent captés et affichent le message). */
.btn-reception-alert-expired,
.btn-reception-alert-expired:hover {
    border-color: #d6dbe0;
    background: #f4f6f8;
    color: #9aa6b2;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    position: relative;
}

.btn-reception-alert-expired[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 240px;
    text-align: center;
    background: rgba(44, 62, 80, 0.95);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: normal;
    z-index: 40;
    pointer-events: none;
}

.btn-reception-alert-expired[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(44, 62, 80, 0.95);
    z-index: 41;
    pointer-events: none;
}

.reception-alert-hint {
    color: #6b7280;
    font-size: 0.88rem;
    margin: 4px 0 14px;
}

.reception-alert-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 4px;
}

.reception-alert-thumb {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e6edf3;
}

.reception-alert-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reception-alert-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(44, 62, 80, 0.85);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reception-alert-error {
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    background: #fdf2f0;
    border: 1px solid #f5c6c0;
    color: #c0392b;
    font-size: 0.85rem;
}

/* ─── Page Aide ───────────────────────────────────────────────────────────── */
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.help-card {
    background: #fff;
    border: 1px solid #e6edf3;
    border-radius: 14px;
    padding: 20px 22px;
}

.help-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.help-card-head i {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(39, 174, 96, 0.12);
    color: #27ae60;
    font-size: 1rem;
}

.help-card-head h2 {
    margin: 0;
    font-size: 1.08rem;
    color: #2c3e50;
}

.help-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: help;
}

.help-step {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid #f0f3f6;
}

.help-step:first-child {
    border-top: none;
}

.help-step-num {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: #f4f8f5;
    color: #27ae60;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.help-step-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.help-step-body strong {
    color: #2c3e50;
    font-size: 0.95rem;
}

.help-step-body span {
    color: #5f6f7e;
    font-size: 0.86rem;
    line-height: 1.4;
}

.help-step-highlight {
    background: #fff8f0;
    border-radius: 10px;
    margin: 4px -8px;
    padding: 10px 8px;
    border-top: none;
}

.help-step-highlight .help-step-num {
    background: rgba(230, 126, 34, 0.14);
    color: #e67e22;
}

.help-card-tutorial p {
    color: #5f6f7e;
    font-size: 0.9rem;
    margin: 0 0 14px;
}

.help-blog {
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
    padding: 20px 22px;
    border-radius: 14px;
    border: 1px solid rgba(39, 174, 96, 0.25);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1), #ffffff 70%);
    transition: box-shadow 0.15s, transform 0.1s;
}

.help-blog:hover {
    box-shadow: 0 14px 30px -18px rgba(39, 174, 96, 0.6);
    transform: translateY(-1px);
}

.help-blog-icon {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #27ae60;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.help-blog-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.help-blog-kicker {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #27ae60;
    font-weight: 700;
}

.help-blog-body strong {
    color: #2c3e50;
    font-size: 1.05rem;
}

.help-blog-text {
    color: #5f6f7e;
    font-size: 0.86rem;
    line-height: 1.4;
}

.help-blog-cta {
    flex: 0 0 auto;
    color: #27ae60;
    font-size: 1.1rem;
}

/* ============================================================================
   RESPONSIVE MOBILE — parcours client (smartphone / tablette terrain)
   ----------------------------------------------------------------------------
   Adaptation ciblée pour les utilisateurs mobiles (ex. un débouché dans son
   champ qui voit arriver une citerne). Aucune règle ci-dessous ne touche le
   rendu desktop : tout est sous media queries max-width. Breakpoint principal
   900px, aligné sur l'existant (nav hamburger, Enlèvements en cartes, volet
   plein écran). Le formulaire « Création de gisement » est traité à part dans
   css/gisement-creator.css.
   ============================================================================ */

@media (max-width: 900px) {

    /* ---- Confort tactile global ---- */
    /* iOS zoome sur tout champ dont la police < 16px : on neutralise ce zoom. */
    input,
    select,
    textarea {
        font-size: 16px;
    }
    /* Cibles tactiles confortables (≥ 44px de haut) sur les contrôles courants. */
    .btn-filter-toggle,
    .btn-export,
    .doc-tab,
    .tour-nav-btn,
    .multiselect-trigger {
        min-height: 44px;
    }

    /* ---- Largeur des vues : on récupère de la place latérale ---- */
    .container-width {
        padding: 14px 12px 36px;
    }
    .view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 18px;
    }
    .view-header h1 {
        font-size: 1.4rem;
    }

    /* ---- Barres d'action (Documents, Reporting) : on empile et on étale ---- */
    .filter-action-bar {
        flex-wrap: wrap;
        padding: 12px 14px;
    }
    .filter-action-bar .filter-input-search {
        flex: 1 1 100%;
    }
    .filter-action-bar .btn-filter-toggle,
    .filter-action-bar .btn-export {
        flex: 1 1 auto;
        justify-content: center;
    }

    /* ---- Filtres : chaque groupe passe pleine largeur, sans débordement ---- */
    .filters-bar {
        padding: 16px 14px;
    }
    .filter-group {
        flex: 1 1 100%;
        flex-wrap: wrap;
    }
    .custom-multiselect {
        width: 100%;
    }
    .multiselect-dropdown {
        width: 100%;
        max-width: calc(100vw - 32px);
    }

    /* ---- Reporting : graphiques plus compacts pour tenir à l'écran ---- */
    .chart-container {
        height: 300px;
        padding: 16px 14px;
    }
    .chart-container canvas {
        min-height: 220px;
    }
    .reporting-compartment-header h2 {
        font-size: 1.2rem;
    }

    /* ---- Documents : onglets scrollables horizontalement si besoin ---- */
    .documents-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .doc-tab {
        flex: 0 0 auto;
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    /* ---- Documents : tableaux Factures / BDC en cartes empilées ----
       Même principe que la vue Enlèvements : en-tête masqué, chaque ligne
       devient une carte. 5 colonnes : Numéro · Statut · Date · HT · TTC. */
    #invoice-view .table-responsive {
        overflow-x: visible;
        max-height: none !important;
    }
    #invoice-view .data-table {
        min-width: 0;
    }
    #invoice-view .data-table thead {
        display: none;
    }
    #invoice-view .data-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        column-gap: 12px;
        row-gap: 4px;
        padding: 14px 16px;
        border-bottom: 1px solid #f1f2f6;
        align-items: center;
    }
    #invoice-view .data-table tbody td {
        border: none !important;
        padding: 0;
        font-size: 0.9rem;
    }
    /* Numéro — titre de la carte (haut-gauche) */
    #invoice-view .data-table tbody td:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
        font-weight: 700;
        font-size: 1rem;
        color: #2c3e50;
    }
    /* Statut — sous le numéro */
    #invoice-view .data-table tbody td:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }
    /* Date — bas-gauche, discrète */
    #invoice-view .data-table tbody td:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
        color: #636e72;
        font-size: 0.82rem;
    }
    /* Total HT — droite, discret */
    #invoice-view .data-table tbody td:nth-child(4) {
        grid-column: 2;
        grid-row: 2;
        text-align: right;
        color: #636e72;
        font-size: 0.82rem;
    }
    /* Total TTC + chevron — haut-droite, mis en avant */
    #invoice-view .data-table tbody td:nth-child(5) {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-end;
        gap: 10px;
        font-weight: 700;
        color: #27ae60;
    }

    /* ---- Profil : champs prénom/nom et boutons sur une seule colonne ---- */
    .profile-name-row {
        flex-direction: column;
        gap: 16px;
    }
    #profile-form > div:last-child {
        flex-wrap: wrap;
        gap: 10px;
    }
    #profile-form > div:last-child button {
        flex: 1 1 150px;
        justify-content: center;
    }

    /* ---- Volet latéral (détail tour, saisie pesée, documents) ---- */
    .side-panel-content {
        padding: 16px;
    }
    .detail-row {
        gap: 12px;
    }

    /* ---- Aide : cartes en une colonne, entête de blog empilé ---- */
    .help-grid {
        grid-template-columns: 1fr;
    }
    .help-blog {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* ---- Modales : largeur utile, hauteur bornée + scroll interne ---- */
    .modal-content {
        width: calc(100vw - 24px);
        max-height: 88vh;
        overflow-y: auto;
        padding: 22px 18px;
    }
}

/* ---- Très petits écrans (téléphones) : derniers ajustements ---- */
@media (max-width: 560px) {
    .view-header h1 {
        font-size: 1.25rem;
    }
    /* Login : carte centrée et un peu remontée, jamais collée aux bords. */
    #login-view {
        justify-content: center;
        padding-right: 0;
        padding-left: 0;
        padding-top: 12vh;
    }
    .login-box {
        width: min(360px, calc(100vw - 28px));
        padding: 2rem 1.5rem;
    }
}
