/* ========== Tech PWA — visuel calqué sur l'app iOS TechnicienTerrain ========== */

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
}

body.app-mode {
    background: var(--bg-dark);
    touch-action: manipulation;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.view.hidden { display: none; }

/* ========== Header ========== */

.tech-header {
    padding: max(env(safe-area-inset-top), 14px) 18px 0 18px;
    background: var(--bg-dark);
    flex-shrink: 0;
}

.tech-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
}

.tech-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.tech-brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.tech-brand-text {
    min-width: 0;
}

.tech-brand-company {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tech-brand-name {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.2;
    margin-top: 2px;
}

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

.header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon-globe {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.18);
    color: var(--accent-green);
}

.header-icon-globe.offline {
    background: rgba(196, 30, 58, 0.18);
    color: var(--accent-red);
}

.day-block {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.day-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.day-date {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.15;
    margin-top: 2px;
    letter-spacing: -0.01em;
}

.order-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.order-btn:active { background: var(--bg-elevated); }
.order-btn svg { transition: transform 0.18s ease; }
.order-btn.desc svg { transform: rotate(180deg); }

/* ========== Search bar ========== */

.search-wrap {
    position: relative;
    z-index: 20;
    padding: 0 18px;
    margin-bottom: -44px;
    pointer-events: none;
    flex-shrink: 0;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(43, 41, 56, 0.72);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 12px;
    padding: 10px 14px;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    pointer-events: all;
}

.search-bar .search-icon { color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
    flex: 1;
    background: transparent;
    border: 0;
    color: var(--text-primary);
    font-size: 16px;
}

.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { outline: none; }

/* ========== Main scroll area ========== */

.tech-main {
    flex: 1 1 0;
    min-height: 0;           /* requis pour overflow-y dans flex parent (bug iOS) */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 58px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tech-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-size: 14px;
}

/* ========== Client card ========== */

.client-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px 18px 18px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: background 0.12s, transform 0.05s;
}

.client-card:active {
    transform: scale(0.99);
    background: var(--bg-card-hover);
}

.client-card-info {
    flex: 1;
    min-width: 0;
}

.client-card-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 4px;
}

.client-card-address {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
}

.client-card-phone {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.client-card-note {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.client-card-note .note-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: 1px;
    background: var(--bg-input);
    color: var(--text-muted);
}

.client-card-note-perm {
    color: var(--text-primary);
}
.client-card-note-perm .note-tag {
    background: rgba(245, 158, 11, 0.18);
    color: var(--accent-orange);
}

.client-card-note-tech .note-tag {
    background: rgba(59, 130, 246, 0.18);
    color: var(--accent-blue);
}

.client-card-status {
    flex-shrink: 0;
}

.client-card-status .status-pill {
    padding: 3px 9px;
    font-size: 11px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.status-planned {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.status-in-progress {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.status-not-done {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.status-cancelled {
    background: rgba(160, 160, 176, 0.15);
    color: var(--text-secondary);
}

.status-cancelled-on-site {
    background: rgba(196, 30, 58, 0.15);
    color: var(--accent-red);
}

/* ========== Bottom nav ========== */

.bottom-nav {
    flex-shrink: 0;
    background: var(--bg-darker);
    border-top: 1px solid var(--border-color);
    padding: 4px 0 12px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 50;
}

.nav-tab {
    flex: 1;
    background: transparent;
    border: 0;
    padding: 5px 10px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
}

.nav-tab.active { color: var(--accent-red); }

/* ========== Detail view ========== */

.detail-header {
    padding: max(env(safe-area-inset-top), 14px) 14px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-dark);
    flex-shrink: 0;
}

.back-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:active { background: var(--bg-elevated); }

.detail-header-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
}

.detail-main {
    flex: 1;
    overflow-y: auto;
    padding: 2px 16px max(env(safe-area-inset-bottom), 24px);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 14px;
}

.detail-section-label {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.status-select {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 42px;
}

.client-info-block .client-name {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.005em;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.info-header-title {
    flex: 1;
    min-width: 0;
}

.info-header-meta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: nowrap;
    white-space: nowrap;
    max-width: 60%;
}

.info-header-meta .status-pill,
.info-header-meta .tag-chip {
    flex-shrink: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-header-meta .tag-chip {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: 999px;
    line-height: 1.4;
}

.info-header-meta .status-pill {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.3;
}

.info-header-meta .tag-chip.tag-bio {
    background: var(--accent-green);
    color: white;
}

.client-info-block .client-line {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 4px;
}

/* Lignes cliquables (adresse, téléphone) — visuel léger, comme du texte */
.client-line.tappable {
    background: transparent;
    border: 0;
    padding: 2px 0;
    margin: 2px 0 0 0;
    color: var(--text-secondary);
    cursor: pointer;
    display: block;
    font-size: 15px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    transition: opacity 0.12s;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.18);
}
.client-line.tappable:active { opacity: 0.55; }

/* Action sheet (bottom-up) */
.action-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1500;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    touch-action: none;
}
.action-sheet-backdrop.open { display: flex; animation: as-fade 0.18s ease-out; }
@keyframes as-fade { from { opacity: 0; } to { opacity: 1; } }

.action-sheet {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    width: 100%;
    max-width: 420px;
    max-height: calc(85vh - env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: as-slide 0.22s cubic-bezier(.2,.8,.2,1);
    padding-bottom: max(env(safe-area-inset-bottom), 8px);
}
@keyframes as-slide { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.action-sheet-title {
    padding: 16px 18px 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.action-sheet-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.action-sheet-item {
    background: transparent;
    border: 0;
    color: var(--text-primary);
    text-align: left;
    padding: 16px 20px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
}
.action-sheet-item:last-child { border-bottom: 0; }
.action-sheet-item:active { background: var(--bg-elevated); }
.action-sheet-item.is-selected { background: rgba(196, 30, 58, 0.07); }
.action-sheet-item .as-ic { color: var(--accent-blue); display: flex; align-items: center; }
.action-sheet-item.danger { color: var(--accent-red); }
.action-sheet-item.danger .as-ic { color: var(--accent-red); }

/* Pull tab en haut de chaque sheet */
.sheet-handle-wrap {
    display: flex;
    justify-content: center;
    padding: 10px 0 2px;
    touch-action: none;
}
.sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-light);
}
body.theme-light .sheet-handle {
    background: rgba(0, 0, 0, 0.25);
}

/* Bouton annuler supprimé — disparaît sans laisser d'espace */
.action-sheet-cancel { display: none; }

/* Action sheet — variante avec input (date/time picker) */
.action-sheet-form {
    padding: 14px 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-sheet-form .label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.action-sheet-form input[type="text"],
.action-sheet-form input[type="date"],
.action-sheet-form input[type="time"] {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}

.action-sheet-form input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.action-sheet-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.action-sheet-form-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: 0;
}

.action-sheet-form-actions .btn-cancel {
    background: var(--bg-input);
    color: var(--text-primary);
}

.action-sheet-form-actions .btn-clear {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid rgba(196, 30, 58, 0.3);
}

.action-sheet-form-actions .btn-save {
    background: var(--accent-blue);
    color: white;
}

.client-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    margin-bottom: 14px;
}

.tag-chip {
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
}

.tag-chip.tag-bio {
    background: var(--accent-green);
    color: white;
    font-weight: 700;
}

.tech-note-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.tech-note-box {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tech-note-box.tech-note-perm {
    border-left: 3px solid var(--accent-orange);
}

/* ========== Report ========== */

.report-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.report-meta strong { color: var(--text-primary); font-weight: 600; }

.report-meta .meta-tap {
    cursor: pointer;
    border-radius: 6px;
    padding: 4px 6px;
    transition: background 0.12s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.18);
}
.report-meta .meta-tap:hover { background: var(--bg-input); }
.report-meta .meta-tap:active { background: var(--bg-elevated); }
.report-meta .meta-tap .meta-edit-ic {
    color: var(--text-muted);
    opacity: 0.6;
    display: inline-flex;
    flex-shrink: 0;
}

.report-meta .meta-sep {
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.6;
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.report-grid .full { grid-column: 1 / -1; }

.report-input,
.report-select {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 15px;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
}

.report-select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.report-input::placeholder, .report-select option:disabled { color: var(--text-muted); }
.report-input:focus, .report-select:focus { outline: none; border-color: var(--accent-blue); }

/* Certificat = lecture seule (auto-rempli depuis le certificat du tech) */
.report-input-readonly {
    background: var(--bg-input) !important;
    opacity: 0.7;
    cursor: not-allowed;
}
.report-input-readonly:focus { border-color: var(--border-light) !important; }

/* Champs du rapport verrouillés tant que le statut est 'planned' / 'not_done' */
.report-input-locked {
    opacity: 0.45;
    cursor: not-allowed;
    /* PAS de pointer-events:none : on veut capter le click pour afficher le toast */
}

/* Toast d'avertissement — apparaît AU-DESSUS de 'Statut de réservation' quand
   le tech tap un champ verrouillé. N'affecte pas la mise en page (max-height
   animée pour ne pas pousser le contenu), disparaît après 2.5s. */
.report-lock-toast {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--accent-orange);
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    padding: 10px 14px;
    margin: 0;
    display: none;       /* totalement absent du flow quand caché */
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}
.report-lock-toast.show {
    display: block;
    opacity: 1;
}

.report-textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    width: 100%;
    min-height: 110px;
    resize: vertical;
    font-family: inherit;
}

.report-textarea:focus { outline: none; border-color: var(--accent-blue); }

/* === Card multi-produits === */
.report-product-card {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
}

.report-product-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    gap: 10px;
}

.report-product-hint {
    font-size: 15px;
    color: var(--text-muted);
}

.report-product-add-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--accent-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}
.report-product-add-btn:active { opacity: 0.75; }
.report-product-add-btn:disabled { opacity: 0.35; }

.report-product-row {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border-top: 1px solid var(--border-light);
    gap: 10px;
    user-select: none;
    -webkit-user-select: none;
}
.report-product-row:active { background: var(--bg-elevated); }

.report-product-name {
    flex: 1;
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.report-product-qty-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
}
.report-product-qty-btn.has-value { color: var(--text-primary); }
.report-product-qty-btn.empty { color: var(--text-muted); font-style: italic; border-color: var(--accent-red); }
.report-product-qty-btn:active { opacity: 0.7; }
.report-product-qty-btn:disabled { opacity: 0.35; }

.report-product-qty-na {
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

.product-name-suffix {
    opacity: 0.5;
    font-size: 0.87em;
}

/* === Bottom sheet multi-sélect produits === */
.action-sheet-check-item { gap: 14px; }

.check-circle {
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.action-sheet-check-item.checked .check-circle {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: #fff;
}

.report-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.btn-action {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: 0;
}

.btn-start {
    background: var(--accent-blue);
    color: white;
}

.btn-finish {
    background: var(--accent-green);
    color: white;
}

.btn-reopen {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

/* ========== Login view ========== */

.login-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 30px 24px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}

.login-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.login-sub {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ========================================
   Mode clair — override des variables CSS
   Activé par body.theme-light (set en JS au boot, géré par bouton Paramètres)
   ======================================== */
body.theme-light {
    --bg-dark:        #f5f5f7;
    --bg-darker:      #ffffff;
    --bg-card:        #ffffff;
    --bg-card-hover:  #f0f0f5;
    --bg-input:       #f0f0f5;
    --bg-elevated:    #e8e8ed;

    --text-primary:   #1a1a2e;
    --text-secondary: #5a5a6a;
    --text-muted:     #8a8a9a;

    --border-color:   #e5e5ea;
    --border-light:   #d5d5da;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* En mode clair : SEULE la ligne logo + boutons (.tech-header-row) est jaune,
   pas tout le bloc header (qui contient aussi date + recherche). */
body.theme-light .tech-header {
    background: var(--bg-dark);
}
/* Geometry de la barre header — partagée par les 3 accents */
body.theme-light .tech-header-row {
    margin: calc(-1 * max(env(safe-area-inset-top), 14px)) -18px 14px -18px;
    padding: max(env(safe-area-inset-top), 14px) 18px 10px 18px;
}

/* === Accent JAUNE (default) === */
body.theme-light.accent-yellow .tech-header-row {
    background: #ffe082;
    border-bottom: 1px solid #f0c040;
}
body.theme-light.accent-yellow .bottom-nav {
    background: #ffe082;
    border-top: 1px solid #f0c040;
}

/* === Accent BOURGOGNE (rouge Abat) === */
body.theme-light.accent-burgundy .tech-header-row {
    background: #c41e3a;
    border-bottom: 1px solid #a01828;
    color: #fff;
}
body.theme-light.accent-burgundy .tech-header-row * { color: #fff !important; }
body.theme-light.accent-burgundy .tech-header-row .tech-brand-name { color: rgba(255,255,255,0.85) !important; }
body.theme-light.accent-burgundy .bottom-nav {
    background: #c41e3a;
    border-top: 1px solid #a01828;
}
body.theme-light.accent-burgundy .nav-tab { color: rgba(255,255,255,0.7); }
body.theme-light.accent-burgundy .nav-tab.active { color: #fff; }

/* === Accent BLEU (= bg du mode sombre) === */
body.theme-light.accent-blue .tech-header-row {
    background: #1a1a2e;
    border-bottom: 1px solid #2a2a4a;
    color: #fff;
}
body.theme-light.accent-blue .tech-header-row * { color: #fff !important; }
body.theme-light.accent-blue .tech-header-row .tech-brand-name { color: rgba(255,255,255,0.85) !important; }
body.theme-light.accent-blue .bottom-nav {
    background: #1a1a2e;
    border-top: 1px solid #2a2a4a;
}
body.theme-light.accent-blue .nav-tab { color: rgba(255,255,255,0.7); }
body.theme-light.accent-blue .nav-tab.active { color: var(--accent-red); }
body.theme-light .search-bar {
    background: rgba(245, 245, 247, 0.78);
    border: 1px solid rgba(0,0,0,0.1);
}

/* ── Toasts : snackbar centré en bas, au-dessus de la nav bar ── */
body.app-mode .toast-container {
    top: auto;
    right: 20px;
    left: 20px;
    bottom: calc(max(env(safe-area-inset-bottom), 14px) + 76px);
    align-items: stretch;
}
/* Vue detail : pas de nav bar, juste au-dessus de la safe area */
body[data-view="detail"] .toast-container {
    bottom: calc(max(env(safe-area-inset-bottom), 14px) + 20px);
}

/* Style snackbar — cohérent avec les cards de l'app */
body.app-mode .toast {
    border-left: none;
    border-radius: 14px;
    background: var(--bg-elevated);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    padding: 12px 16px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-up 0.22s cubic-bezier(.2,.8,.2,1);
    text-align: left;
}
@keyframes toast-up {
    from { transform: translateY(10px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
/* Dot coloré selon le type */
body.app-mode .toast::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-blue);
    flex-shrink: 0;
}
body.app-mode .toast-success::before { background: var(--accent-green); }
body.app-mode .toast-error::before   { background: var(--accent-red); }

/* Asterisque rouge pour champs obligatoires du rapport */
.required-asterisk {
    color: var(--accent-red);
    font-weight: 800;
    margin-left: 2px;
}
/* toast-bottom : même position que toast-container par défaut */
body.app-mode .toast-bottom {
    top: auto;
    bottom: calc(max(env(safe-area-inset-bottom), 14px) + 76px);
    left: 20px;
    right: 20px;
    align-items: stretch;
}

/* Bandeau validation champs manquants (inline, même style que report-lock-toast) */
.report-missing-toast {
    background: rgba(196, 30, 58, 0.12);
    border: 1px solid rgba(196, 30, 58, 0.35);
    color: var(--accent-red);
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    padding: 10px 14px;
    margin-bottom: 0;
    display: none;
    opacity: 0;
    transition: opacity 0.18s ease;
}
.report-missing-toast.show {
    display: block;
    opacity: 1;
}

/* ========== Badge sync hors-ligne ========== */

/* Position relative nécessaire pour le badge absolu */
.header-icon-btn {
    position: relative;
}

/* Pastille numérique sur le bouton réseau */
.sync-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: var(--accent-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    padding: 0 3px;
    pointer-events: none;
    box-sizing: border-box;
}

/* En ligne mais des changements en attente de sync → orange */
.header-icon-globe.has-pending {
    background: rgba(234, 179, 8, 0.18);
    color: var(--accent-yellow);
}

/* Mode clair accent-yellow : fond jaune clair → saturé + texte sombre */
body.theme-light.accent-yellow .header-icon-globe {
    background: rgba(22, 163, 74, 0.18);
    color: #15803d !important;
}
body.theme-light.accent-yellow .header-icon-globe.offline {
    background: rgba(196, 30, 58, 0.15);
    color: #b91c1c !important;
}
body.theme-light.accent-yellow .header-icon-globe.has-pending {
    background: rgba(180, 83, 9, 0.15);
    color: #92400e !important;
}

/* Mode clair accent-burgundy : fond rouge → pill sombre solide + icône vif */
body.theme-light.accent-burgundy .header-icon-globe {
    background: #14532d;
    color: #4ade80 !important;
}
body.theme-light.accent-burgundy .header-icon-globe.offline {
    background: #1c0505;
    color: #f87171 !important;
}
body.theme-light.accent-burgundy .header-icon-globe.has-pending {
    background: #422006;
    color: #fcd34d !important;
}

/* Mode clair accent-blue : même fond sombre → pill identique au dark mode */
body.theme-light.accent-blue .header-icon-globe {
    background: #14532d;
    color: #4ade80 !important;
}
body.theme-light.accent-blue .header-icon-globe.offline {
    background: #450a0a;
    color: #f87171 !important;
}
body.theme-light.accent-blue .header-icon-globe.has-pending {
    background: #422006;
    color: #fcd34d !important;
}
