/* Feuille de style unique. Thème clair par défaut, sombre selon le navigateur (data-theme="auto")
   ou selon le choix enregistré dans le profil (data-theme="light" | "dark"). UI-02, UI-04. */

:root {
    --bg: #ffffff;
    --bg-alt: #f3f4f6;
    --text: #1f2328;
    --text-muted: #57606a;
    --border: #d0d7de;
    --link: #0b57d0;
    --focus: #b3261e;
    --sidebar-bg: #f3f4f6;
    --danger: #b3261e;
    --warning-bg: #fff4ce;
    --warning-text: #5c4400;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        --bg: #16181d;
        --bg-alt: #22252b;
        --text: #e6e8eb;
        --text-muted: #a8b0ba;
        --border: #3d434c;
        --link: #8ab4f8;
        --focus: #ffb4ab;
        --sidebar-bg: #1d2026;
        --danger: #ffb4ab;
        --warning-bg: #3f3200;
        --warning-text: #ffe08a;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #16181d;
    --bg-alt: #22252b;
    --text: #e6e8eb;
    --text-muted: #a8b0ba;
    --border: #3d434c;
    --link: #8ab4f8;
    --focus: #ffb4ab;
    --sidebar-bg: #1d2026;
    --danger: #ffb4ab;
    --warning-bg: #3f3200;
    --warning-text: #ffe08a;
    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* L'attribut hidden l'emporte toujours, même sur une classe qui fixe display (par exemple .inline-form). */
[hidden] {
    display: none !important;
}

/* Texte lu par les lecteurs d'écran seulement. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--link);
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: -9999px;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    z-index: 10;
    padding: 0.5rem 1rem;
    background: var(--bg);
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    flex: 0 0 15rem;
    padding: 1rem;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
}

/* Cahier 1.9 : au-delà de 700 px, le menu reste à l'écran et défile seul s'il dépasse la hauteur de la fenêtre ;
   le bloc du compte et la version restent atteignables sans faire défiler la page. */
@media (min-width: 701px) {
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar a {
    display: block;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
}

.sidebar a[aria-current="page"] {
    font-weight: 600;
    background: var(--bg);
}

.content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.5rem;
}

.error-page {
    max-width: 40rem;
    margin: 4rem auto;
    padding: 0 1rem;
}

/* Pastille de couleur : --item-color est posée par colors.js. Toujours accompagnée d'un libellé texte. */
.color-chip {
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-right: 0.35em;
    border-radius: 50%;
    background: var(--item-color, var(--text-muted));
    vertical-align: baseline;
}

.badge {
    display: inline-block;
    padding: 0 0.5em;
    border-radius: 999px;
    font-size: 0.85em;
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* Bouton « Menu » (UI-03) : seulement sous 700 px ; au-delà, le menu est toujours ouvert (nav.js). */
.sidebar-toggle {
    display: none;
}

@media (max-width: 700px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        flex-basis: auto;
        padding: 0.5rem 1rem;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-title {
        margin-bottom: 0.25rem;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding: 0 0.75rem;
        border: 1px solid var(--border);
        border-radius: 4px;
        background: var(--bg);
        font-weight: 600;
        cursor: pointer;
    }

    .sidebar-menu[open] > .sidebar-toggle {
        margin-bottom: 0.5rem;
    }

    .sidebar a {
        padding: 0.6rem;
    }

    .content {
        padding: 1rem;
    }

    /* Bandeaux de l'admin (cron, administrateur unique) : plus compacts, pour ne pas repousser le contenu. */
    .content > .alert {
        margin: 0 0 0.5rem;
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
        line-height: 1.35;
    }
}

/* Mise en page étroite (installeur, pages simples) et formulaires */
.narrow {
    max-width: 44rem;
}

.sidebar-title {
    margin: 0 0 1rem;
    font-weight: 700;
}

.form label {
    display: block;
    margin-top: 1rem;
    font-weight: 600;
}

.form input,
.form select {
    width: 100%;
    max-width: 30rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

/* Cases à cocher et boutons radio : taille naturelle, case et libellé côte à côte, alignés à gauche ;
   un libellé long revient à la ligne sous son propre texte, pas sous la case. */
input[type="checkbox"],
input[type="radio"],
.form input[type="checkbox"],
.form input[type="radio"] {
    width: auto;
    max-width: none;
    margin: 0.2em 0 0;
    padding: 0;
    flex: none;
}

label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]),
.form label:has(> input[type="checkbox"]),
.form label:has(> input[type="radio"]) {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.5rem;
    font-weight: normal;
    text-align: left;
}

.form fieldset {
    margin: 1.25rem 0 0;
    padding: 0.75rem 1rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    max-width: 32rem;
}

.form legend {
    padding: 0 0.25rem;
    font-weight: 600;
}

.form button,
.actions button {
    margin-top: 1.25rem;
    margin-right: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--link);
    border-radius: 4px;
    background: var(--link);
    color: var(--bg);
    font: inherit;
    cursor: pointer;
}

.field-error {
    margin: 0.25rem 0 0;
    color: var(--danger);
}

.alert,
.notice {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    border-left: 4px solid var(--danger);
    background: var(--bg-alt);
}

.notice {
    border-left-color: var(--link);
}

.steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding-left: 1.25rem;
}

.steps li[aria-current="step"] {
    font-weight: 700;
}

.checks {
    border-collapse: collapse;
    width: 100%;
}

.checks th,
.checks td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.badge-ok {
    background: var(--bg-alt);
    color: var(--text);
}

.badge-error {
    background: var(--danger);
    color: var(--bg);
}

code.break {
    word-break: break-all;
}

.sidebar-user {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.95em;
}

.sidebar-user p {
    margin: 0 0 0.5rem;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--link);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* INS-04 : numéro de version (admin), discret ; --text-muted garde le contraste AA sur le fond du menu. */
.sidebar-version {
    margin: 1.5rem 0 0;
    font-size: 0.85em;
    color: var(--text-muted);
}

.sidebar-heading {
    margin: 1.5rem 0 0.5rem;
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Sections repliables du menu (« Liens externes », « Administration ») : <summary> natif, triangle compris. */
summary.sidebar-heading {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
}

summary.sidebar-heading:hover {
    color: var(--text);
}

@media (max-width: 700px) {
    summary.sidebar-heading {
        min-height: 44px;
        padding: 0.75rem 0.6rem;
    }
}

.data-table {
    border-collapse: collapse;
    width: 100%;
}

.data-table th,
.data-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table-scroll {
    overflow-x: auto;
}

.inline-form {
    display: inline;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: flex-end;
}

.filters label {
    display: block;
    font-weight: 600;
}

.pagination {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.muted {
    color: var(--text-muted);
}

/* Listes paramétrables : un bloc par élément. */
.list-item {
    margin: 1.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.list-item h2 {
    font-size: 1.1rem;
}

/* Liens externes (LNK-01) : page « Liens » et Administration › Liens. Couleurs reprises des jetons (contraste
   du lien sur le fond : 6,4:1 en clair, 8,4:1 en sombre). */
.links {
    padding-left: 1.25rem;
}

.links li {
    margin: 0.5rem 0;
}

.link-name {
    font-weight: 600;
}

.link-admin {
    padding-left: 1.5rem;
}

.link-admin-item {
    margin: 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.link-admin-name {
    margin: 0 0 0.5rem;
}

.link-admin-url {
    overflow-wrap: anywhere;
}

.link-admin-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.link-admin-actions button {
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--link);
    border-radius: 4px;
    background: var(--bg);
    color: var(--link);
    font: inherit;
    cursor: pointer;
}

/* Poignée du glisser-déposer (sortable-list.js, cahier 1.9) : seule elle démarre le glisser, pour ne pas gêner le
   défilement au doigt. Cachée sans JavaScript (attribut hidden). */
.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    min-height: 2rem;
    margin-right: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-muted);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

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

@media (max-width: 700px) {
    /* Cibles d'au moins 44 px de haut au toucher (UI-03). */
    .links a,
    .link-admin-actions a,
    .link-admin-actions button {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .drag-handle {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Zones de texte libre des formulaires (description d'un bloc, d'une tâche, d'un événement, note d'une entité,
   compte-rendu, texte d'un modèle) : toute la largeur utile, comme une page étroite (44rem). */
.form textarea {
    width: 100%;
    max-width: 44rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    line-height: 1.5;
}

.template-fields li {
    margin: 0.25rem 0;
}

/* Générateur de messages (MSG-02) : objet et texte en lecture seule, à sélectionner ou à copier par le bouton. */
.message-preview label {
    display: block;
    margin-top: 1rem;
    font-weight: 600;
}

.message-preview input,
.message-preview textarea {
    width: 100%;
    max-width: 44rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-alt);
    color: var(--text);
    font: inherit;
    line-height: 1.5;
}

button.danger {
    background: var(--danger);
    color: var(--bg);
}

/* Entités : badges d'alerte (toujours un libellé texte, la couleur n'est qu'un complément). */
.badge-due {
    background: var(--danger);
    color: var(--bg);
}

.badge-inactive {
    background: var(--bg-alt);
    color: var(--text);
    border: 1px solid var(--border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badges .badge {
    margin-right: 0.4em;
}

/* RGPD-03 : avertissement près de la note et des comptes-rendus. */
/* Mise en garde en bandeau (page « Exports »). L'avertissement RGPD-03 des formulaires est une aide discrète (.muted). */
.rgpd-warning {
    margin: 0.25rem 0;
    padding: 0.25rem 0.5rem;
    border-left: 4px solid var(--warning-text);
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: 0.9em;
}

/* Texte saisi sur plusieurs lignes, affiché tel quel (échappé, sans HTML). */
.multiline {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
}

.facts dt {
    font-weight: 600;
}

.facts dd {
    margin: 0;
}

.timeline {
    list-style: none;
    padding: 0;
}

.timeline > li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.actions a,
.actions .button {
    margin-right: 0.75rem;
}

a.button {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    background: var(--link);
    color: var(--bg);
    text-decoration: none;
}

.link-button {
    background: none;
    border: none;
    padding: 0.2rem 0;
    color: var(--link);
    text-decoration: underline;
    cursor: pointer;
}

.contact-row {
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border);
}

.filter-flags label {
    display: block;
}

/* Accueil : blocs (HOM-01). */
.home-block {
    margin-bottom: 1.5rem;
}

/* Événements (EVT-01) : liste des entités à cocher, défilante ; événement annulé atténué (CAL-01). */
.checklist-items {
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
}

.checklist-items label {
    display: block;
}

.data-table tr.cancelled td,
li.cancelled {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* Tâches (TSK-01, CA-J2-09, UI-03) : trois colonnes côte à côte ; empilées sous 700 px (1.3). */
.kanban {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

/* La liste des cartes occupe toute la hauteur de la colonne : une colonne vide reste une zone de dépôt sur toute sa
   hauteur (SortableJS ne reçoit une carte que dans le cadre de la liste). */
.kanban-column {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 14rem;
    max-width: 30rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-alt);
}

.kanban-column h2 {
    font-size: 1.1rem;
    margin-top: 0;
}

.kanban-cards {
    flex: 1 1 auto;
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 6rem;
}

.kanban-cards:not(:has(> li)) {
    border: 2px dashed var(--border);
    border-radius: 4px;
}

.task-card {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
}

.task-card[data-movable="1"] {
    cursor: grab;
}

.task-card-title {
    margin: 0 0 0.25rem;
    font-weight: 700;
}

.task-card-facts {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.task-moves {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.task-moves button {
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
}

.sortable-ghost {
    opacity: 0.4;
}

/* Checklist des sous-tâches (TSK-04, 1.3) */
.checklist {
    margin: 0.5rem 0;
}

.checklist-count {
    margin: 0 0 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.checklist-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.2rem 0;
}

.checklist-form {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

input.checklist-box {
    width: 1.15rem;
    height: 1.15rem;
    cursor: pointer;
}

input.checklist-box:disabled {
    cursor: default;
}

.checklist-button {
    font-size: 0.85rem;
    padding: 0.1rem 0.5rem;
}

.task-card .checklist {
    font-size: 0.9rem;
}

@media (max-width: 700px) {
    .kanban {
        flex-direction: column;
        overflow-x: visible;
    }

    .kanban-column {
        flex: none;
        min-width: 0;
        max-width: none;
    }

    .kanban-cards {
        min-height: 4rem;
    }

    /* Cibles d'au moins 44 px de haut au toucher. */
    .task-moves button,
    .checklist-button {
        min-height: 44px;
    }

    .checklist-item {
        min-height: 44px;
        align-items: center;
    }

    input.checklist-box {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* Calendrier (CAL-01, UI-03, UI-04). Couleurs des sources : contraste d'au moins 3:1 sur le fond, en clair comme en
   sombre ; elles ne portent jamais seules l'information (texte « Échéance : », « Relance : », légende). */
:root {
    --cal-events: #0b57d0;
    --cal-tasks: #6639ba;
    --cal-follow-ups: #9a4b00;
    --cal-newsletters: #00796b;
    --cal-dates: #8d6e00;
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        --cal-events: #8ab4f8;
        --cal-tasks: #c9a7ff;
        --cal-follow-ups: #ffa657;
        --cal-newsletters: #4dd0c4;
        --cal-dates: #e3c04f;
    }
}

:root[data-theme="dark"] {
    --cal-events: #8ab4f8;
    --cal-tasks: #c9a7ff;
    --cal-follow-ups: #ffa657;
    --cal-newsletters: #4dd0c4;
    --cal-dates: #e3c04f;
}

.cal-src-evenements {
    --cal-color: var(--cal-events);
}

.cal-src-taches,
.cal-src-taches-faites {
    --cal-color: var(--cal-tasks);
}

.cal-src-relances {
    --cal-color: var(--cal-follow-ups);
}

/* Itérations de newsletter : pastille carrée en plus du texte « Newsletter : » (jamais la couleur seule). */
.cal-src-newsletters {
    --cal-color: var(--cal-newsletters);
}

.cal-src-newsletters .cal-chip {
    border-radius: 2px;
}

/* Dates importantes (DIM-03) : pastille en losange en plus du texte « Date importante : » (jamais la couleur
   seule) ; la catégorie a sa couleur facultative, sinon celle de la source. */
.cal-src-dates {
    --cal-color: var(--cal-dates);
}

.cal-src-dates .cal-chip,
.date-chip {
    border-radius: 0;
    transform: rotate(45deg) scale(0.85);
}

.cal-src-dates .cal-label,
.cal-src-dates a {
    font-weight: 600;
}

.field-hint {
    margin: 0.15rem 0 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.important-dates li {
    margin-bottom: 0.5rem;
}

/* Pastille : couleur de la catégorie (tâche, posée par colors.js) ou, à défaut, celle de la source. */
.cal-chip {
    background: var(--item-color, var(--cal-color, var(--text-muted)));
    border: 1px solid var(--cal-color, var(--border));
}

/* Titre de page et bouton d'action sur la même ligne ; le bouton passe à la ligne si l'écran est étroit. */
.page-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.page-head h1 {
    margin-right: auto;
}

/* Une seule barre : période à gauche, vue à droite ; sur deux lignes quand la place manque. */
.cal-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    align-items: center;
    justify-content: space-between;
    margin: 1rem 0 0.75rem;
}

.cal-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cal-views ul {
    display: flex;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cal-views a[aria-current="page"] {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    border-bottom: 3px solid var(--text);
}

/* Sources : une ligne compacte, sans cadre ; le titre « Sources affichées » (legend flottant) se range en tête de la
   ligne comme un élément de plus, tout en restant le nom du groupe pour les lecteurs d'écran. */
.cal-sources fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    align-items: center;
    margin: 0 0 0.5rem;
    padding: 0.5rem 0;
    border: 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.cal-sources legend {
    float: left;
    padding: 0;
    font-weight: 600;
}

/* Sous le calendrier : liens « Voir aussi » et légende repliée (details natif, sans JavaScript). */
.cal-see-also {
    margin-top: 2rem;
}

.cal-see-also h2 {
    font-size: 1.1rem;
}

.cal-see-also ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
}

.cal-legend {
    margin: 1.25rem 0;
    max-width: 44rem;
}

.cal-legend summary {
    cursor: pointer;
    font-weight: 600;
}

.cal-legend p {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
}

.cal-sources button {
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--link);
    border-radius: 4px;
    background: var(--link);
    color: var(--bg);
    font: inherit;
    cursor: pointer;
}

.calendar-grid {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.calendar-grid th {
    padding: 0.25rem;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    font-weight: 600;
    text-align: left;
}

.calendar-grid td {
    height: 6.5rem;
    padding: 0.25rem;
    border: 1px solid var(--border);
    vertical-align: top;
    overflow-wrap: anywhere;
}

.calendar-grid td.cal-out {
    background: var(--bg-alt);
}

.calendar-grid td.cal-out .cal-num {
    color: var(--text-muted);
}

.cal-date {
    margin: 0 0 0.25rem;
    font-weight: 600;
}

/* Date longue : lue par les lecteurs d'écran dans la grille, affichée quand les jours s'empilent. */
.cal-long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Aujourd'hui : cadre épais et étiquette « Aujourd'hui » (pas seulement une couleur). */
.calendar-grid td.cal-today,
.cal-list-day.cal-today {
    outline: 3px solid var(--text);
    outline-offset: -3px;
}

.cal-today-badge {
    background: var(--text);
    color: var(--bg);
    font-weight: 600;
}

.cal-items {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
}

.cal-item {
    margin: 0.15rem 0;
}

.cal-time {
    font-weight: 600;
}

.cal-notes,
.cal-muted,
.cal-muted a {
    color: var(--text-muted);
}

.cal-src-evenements.cal-muted a,
.cal-struck a {
    text-decoration: line-through;
}

.cal-list-day {
    margin: 0 0 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.cal-list-day h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.cal-list .cal-items {
    font-size: 1rem;
}

/* Sous 700 px : les jours s'empilent, chacun avec sa date en toutes lettres ; dans la vue mois, les jours vides et
   ceux d'un autre mois sont masqués (aujourd'hui reste visible). Cibles d'au moins 44 px de haut. */
@media (max-width: 700px) {
    .calendar-grid,
    .calendar-grid tbody,
    .calendar-grid tr,
    .calendar-grid td {
        display: block;
        width: auto;
    }

    .calendar-grid thead {
        display: none;
    }

    .calendar-grid td {
        height: auto;
        margin-bottom: 0.5rem;
        padding: 0.5rem 0.75rem;
    }

    .cal-month td.cal-out,
    .cal-month td.cal-empty:not(.cal-today) {
        display: none;
    }

    .cal-num {
        display: none;
    }

    .cal-long {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
        white-space: normal;
    }

    .cal-items {
        font-size: 1rem;
    }

    .cal-item {
        min-height: 44px;
        padding: 0.4rem 0;
    }

    .cal-nav a.button,
    .cal-views a,
    .cal-sources label,
    .cal-sources button,
    .cal-see-also a,
    .cal-legend summary {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

/* Flux .ics (ICS-01, ICS-02) : adresse affichée une fois, consignes d'abonnement. */
.feed-url {
    margin: 1rem 0;
}

.feed-url label {
    display: block;
    margin-top: 1rem;
    font-weight: 600;
}

.feed-url input {
    width: 100%;
    max-width: 40rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-alt);
    color: var(--text);
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.9em;
}

.feed-help {
    margin: 1.25rem 0;
    max-width: 40rem;
}

.feed-help summary {
    cursor: pointer;
    font-weight: 600;
}

/* Blocs d'une newsletter (3.F) : la description garde ses retours à la ligne, sans HTML. */
.block-description {
    margin: 0 0 0.5rem;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* Champs texte d'une ligne : même largeur que les zones de texte (44rem) ; width: 100 % les garde dans l'écran étroit.
   Dates, heures, nombres et listes restent à 30rem. */
.form input[type="text"],
.form input[type="url"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="search"],
.form input[type="password"] {
    max-width: 44rem;
}

/* Éditeur d'un modèle de process (PRC-11) : bande de blocs reliés par des flèches ; panneaux de réglage dessous.
   Le numéro vient d'un compteur CSS : il suit l'ordre après un glisser-déposer. */
.process-strip-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.process-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: process-block;
}

.process-card {
    position: relative;
    width: 13rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-alt);
    counter-increment: process-block;
}

.process-card:not(:last-child)::after {
    content: "→";
    position: absolute;
    top: 0.75rem;
    right: -1.4rem;
    color: var(--text-muted);
}

.process-card-link {
    display: block;
    margin-bottom: 0.4rem;
    overflow-wrap: anywhere;
}

.process-card-link[aria-current] {
    font-weight: 700;
}

.process-card-type {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.process-card-type::before {
    content: counter(process-block) ". ";
}

.process-card-move {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.process-add {
    padding: 0.5rem;
    border: 1px dashed var(--border);
    border-radius: 4px;
}

.process-add summary {
    cursor: pointer;
}

.process-add-types {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.process-panel {
    max-width: 44rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.process-panel h3 {
    margin-top: 0;
}

@media (max-width: 700px) {
    /* Écran étroit : la bande devient une colonne, les flèches pointent vers le bas (UI-03). */
    .process-strip,
    .process-add {
        width: 100%;
    }

    .process-strip {
        flex-direction: column;
        gap: 1.5rem;
    }

    .process-card {
        width: 100%;
    }

    .process-card:not(:last-child)::after {
        content: "↓";
        top: auto;
        right: auto;
        bottom: -1.4rem;
        left: 0.5rem;
    }

    .process-card-move button,
    .process-add-types button {
        min-height: 44px;
    }
}

/* Page d'un process (PRC-09) : la bande réutilise les cartes de l'éditeur ; l'état est toujours écrit (UI-04). */
.process-run-strip {
    margin-bottom: 1rem;
}

.process-card-current {
    border: 2px solid var(--link);
}

.process-card-done .process-card-type,
.process-card-skipped .process-card-type {
    text-decoration: none;
}

.process-card-skipped strong {
    text-decoration: line-through;
}

.process-note {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.process-run-list li {
    margin-bottom: 0.75rem;
}
