/* ==========================================================================
   EMTOP — Journées terrain (liste, formulaires, intégration Planning et espace Responsable)
   Réutilise les composants de l'administration (adm-*) et du planning (pl-*).
   ========================================================================== */

.jt-page,
.jt-dashboard { --jt-color: #7e57c2; }
.jt-icon { background: color-mix(in srgb, var(--jt-color) 12%, transparent); color: var(--jt-color); }

/* Filtres */
/* 2 lignes : critères (client, commercial, statut) puis période et actions — lisible sur tous les écrans */
.jt-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.jt-filter--search { grid-column: span 3; }
.jt-toolbar.has-commercial .jt-filter--search { grid-column: span 2; }
.jt-filter-actions { grid-column: span 2; justify-content: flex-end; }
.jt-filter .form-label { margin-bottom: .35rem; font-size: .8125rem; }

/* Tableau */
.jt-table .cell-main .adm-entity-name,
.jt-table .cell-main .adm-entity-sub { white-space: nowrap; }
.jt-table .adm-break { overflow-wrap: break-word; } /* coupe entre les mots, jamais au milieu */
.jt-table td[data-label="Client"] { min-width: 150px; }
.jt-table td[data-label="Titre"] { min-width: 170px; }
.jt-titre-inline { display: none; } /* titre sous le client : tablette uniquement */
.jt-calendar {
    display: inline-flex;
    flex-direction: column;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 48px;
    border: 1px solid color-mix(in srgb, var(--jt-color) 25%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--jt-color) 8%, transparent);
    line-height: 1.1;
    color: var(--jt-color);
}

.jt-calendar-day { font-size: 1.0625rem; font-weight: 700; }
.jt-calendar-month { font-size: .6875rem; font-weight: 600; text-transform: uppercase; }
.jt-calendar.is-today { border-color: var(--jt-color); background: var(--jt-color); color: #fff; }

.jt-planning-link { display: inline-flex; align-items: center; gap: 7px; font-size: .8125rem; font-weight: 600; color: var(--jt-color); white-space: nowrap; }
.jt-planning-link:hover { color: var(--jt-color); text-decoration: underline; }
.jt-planning-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--jt-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--jt-color) 20%, transparent); }

/* Formulaire */
.jt-statut-defaut { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.jt-statut-defaut .form-text { display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.jt-statut-defaut .form-text .em-icon { width: 14px; height: 14px; }

.jt-apercu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 0 0 22px;
    padding: 14px 16px;
    border: 1px dashed color-mix(in srgb, var(--jt-color) 40%, transparent);
    border-radius: var(--em-radius-lg);
    background: color-mix(in srgb, var(--jt-color) 5%, var(--em-card-bg));
}

.jt-apercu-label { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; color: var(--em-heading-color); }
.jt-apercu-label .em-icon { width: 16px; height: 16px; color: var(--jt-color); }
.jt-apercu-event { font-size: .8125rem; }
.jt-apercu-date { margin-left: auto; font-size: .8125rem; color: var(--em-body-color); font-variant-numeric: tabular-nums; }
.jt-event-icon { flex-shrink: 0; width: 13px !important; height: 13px !important; color: var(--pl-color); }

.jt-danger-zone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--em-border);
    font-size: .8125rem;
    color: var(--em-muted);
}

.jt-danger-zone > span { display: inline-flex; align-items: center; gap: 6px; }
.jt-danger-zone > span .em-icon { width: 15px; height: 15px; }

/* Planning : événements générés par une journée terrain */
.pl-event-route { flex-shrink: 0; width: 13px !important; height: 13px !important; color: var(--pl-color); }
.pl-item-journee { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; color: var(--pl-color); }
.pl-item-journee .em-icon { width: 13px; height: 13px; }
.pl-counter--legende { border-style: dashed; cursor: default; }
.pl-journee-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, #7e57c2 30%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, #7e57c2 7%, var(--em-card-bg));
    font-size: .8125rem;
    color: var(--em-heading-color);
}

.pl-journee-note[hidden] { display: none; }
.pl-journee-note > span { display: inline-flex; align-items: center; gap: 7px; }
.pl-journee-note .em-icon { width: 16px; height: 16px; color: #7e57c2; }

/* Espace Responsable : prochaines journées terrain */
.jt-dashboard .table > :not(caption) > * > * { padding-top: 12px; padding-bottom: 12px; }

/* Responsive */
/* Écrans moyens : colonnes « Titre » et « Planning » masquées, le titre passe sous le client (tableau complet ≥ 1400 px et vue mobile) */
@media (min-width: 768px) and (max-width: 1399.98px) {
    .jt-table td[data-label="Client"] { min-width: 120px; }
    .jt-table .pl-who { white-space: normal; }
    .jt-table .jt-col-planning,
    .jt-table .jt-col-titre { display: none; }
    .jt-table .jt-titre-inline { display: block; margin-top: 2px; }
}

@media (max-width: 767.98px) {
    .jt-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .jt-filter--search,
    .jt-toolbar.has-commercial .jt-filter--search,
    .jt-toolbar:not(.has-commercial) .jt-filter:nth-child(2),
    .jt-filter-actions { grid-column: 1 / -1; }
    .jt-apercu-date { margin-left: 0; }
    .jt-danger-zone > * { width: 100%; }
    .jt-danger-zone form .btn { width: 100%; }
}
