/*
 * APP — mise en page et composants. Couleurs/police/tailles : theme.css.
 * Sommaire : base · structure · navigation · en-têtes · boutons · listes & tâches ·
 *            fiche · agenda · thèmes · notes · messages · glisser · animations · responsive
 */

/* ========== Base ========== */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--text-size);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
textarea, input { border: 0; background: transparent; outline: none; border-radius: 0; }
textarea { resize: none; overflow: hidden; display: block; width: 100%; padding: 0; }
::placeholder { color: var(--muted); opacity: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea:focus-visible, input:focus-visible { outline: none; }
.icon { width: 18px; height: 18px; flex: none; }
.faint { opacity: .45; }
body.has-sheet { overflow: hidden; }

/* hauteur d'une ligne de liste */
:root { --row-h: calc(var(--row-lh) + 2 * var(--row-pad)); }

/* ========== Structure : barre latérale + contenu ========== */
.desk { display: flex; min-height: 100vh; }
.page {
    flex: 1;
    min-width: 0;
    max-width: 960px;
    margin: 0 auto;
    padding: 36px 40px 80px;
}

/* ========== Navigation ========== */
.tabs {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: var(--sidebar);
    height: 100vh;
    padding: 18px 12px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 5;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 10px 20px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.01em;
}
.tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: left;
    transition: background-color .12s, color .12s;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab__icon { width: 19px; height: 19px; }
.tab.is-active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.tab.is-active .tab__icon { color: var(--tab-color); }
.tab--profile { margin-top: auto; } /* profil (retour, jour / nuit, déconnexion) en bas */
.tab--profile .tab__label--email { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tab--profile .tab__label--short { display: none; }
.ws-face.tab__avatar { width: 24px; height: 24px; font-size: 11.5px; }
.tab__chevron { flex: none; width: 15px; height: 15px; color: var(--muted); transform: rotate(-90deg); }

/* menu du profil */
.profile-menu__who { display: flex; align-items: center; gap: 10px; padding: 4px 6px 2px; }
.profile-menu__email { min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
.profile-menu__icon { flex: none; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: var(--text-2); }
.profile-menu__icon .icon { width: 18px; height: 18px; }
.profile-menu__logout, .profile-menu__logout .profile-menu__icon { color: var(--danger); }
.profile-menu__logout:hover { background: var(--danger-soft); }
.ws-switch-ui.is-on { background: var(--accent); }
.ws-switch-ui.is-on::after { transform: translateX(16px); }

/* ========== Espaces de travail ========== */
.ws-slot--side { margin: -8px 0 14px; }
.ws-slot--top { display: none; }           /* mobile seulement (voir plus bas) */
.ws-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    text-align: left;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color .12s, background-color .12s;
}
.ws-switch:hover { border-color: var(--border-strong); }
.ws-switch__text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ws-switch__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13.5px; font-weight: 600; }
.ws-switch__role { font-size: 11.5px; color: var(--warning); font-weight: 500; }
.ws-switch__chevron { flex: none; width: 16px; height: 16px; color: var(--muted); }
.ws-badge {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px; height: 26px;
    font-size: 13px; font-weight: 700;
    color: #fff;
    border-radius: 7px;
}
.ws-badge .icon { width: 16px; height: 16px; }
.ws-badge--all { color: var(--text-2); background: var(--surface); border: 1px solid var(--border-strong); }
.ws-badge--ghost { color: var(--text-2); background: transparent; border: 1px dashed var(--border-strong); }

.ws-menu__title { margin: 0 0 6px; padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ws-menu__sep { margin: 6px 0; border: 0; border-top: 1px solid var(--border); }
.ws-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 6px;
    text-align: left;
    border-radius: 8px;
}
.ws-option:hover { background: var(--surface-2); }
.ws-option.is-on { font-weight: 600; }
.ws-option__name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
.ws-option__role { font-size: 11.5px; color: var(--warning); font-weight: 500; }
.ws-option__check { flex: none; width: 18px; height: 18px; color: var(--accent); }
.ws-option--action { color: var(--text-2); }
.ws-new__form { display: none; gap: 8px; padding: 4px 6px 8px; }
.ws-new.is-open .ws-new__form { display: flex; }
.ws-new.is-open > .ws-option { display: none; }
.ws-new__input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-size: 16px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    outline: none;
}
.ws-new__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.ws-menu__title--sub { margin-top: 8px; }
.ws-option.is-done .ws-option__name { color: var(--text-2); }
.ws-option.is-done .ws-badge { opacity: .55; }

/* sélecteur + bouton « Partager » */
.ws-bar { display: flex; align-items: center; gap: 6px; }
.ws-bar .ws-switch { flex: 1; min-width: 0; }
.ws-share {
    flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    width: 40px; height: 40px; padding: 0;
    color: var(--text-2); background: transparent; border: 1px solid var(--border); border-radius: 10px;
}
.ws-share:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.ws-share .icon { width: 18px; height: 18px; }
.ws-share__text { display: none; font-size: 13px; font-weight: 600; }

/* ----- fiche de gestion ----- */
.ws-sheet { max-width: 520px; padding-top: 10px; }
.ws-head { display: flex; align-items: center; gap: 6px; margin: 0 -10px 10px; min-height: 40px; }
.ws-head__title { flex: 1; margin: 0 0 0 10px; font-size: 18px; font-weight: 700; }
.ws-head__kicker { flex: 1; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ws-empty { color: var(--muted); }
.ws-hint { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }

/* niveau 1 : liste */
.ws-items { display: flex; flex-direction: column; gap: 2px; }
.ws-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 8px 10px 2px; border-radius: 10px;
    background: var(--surface); cursor: pointer;
}
.ws-item:hover { background: var(--surface-2); }
.ws-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ws-item__grip { flex: none; display: flex; align-items: center; justify-content: center; width: 22px; height: 36px; color: var(--muted); cursor: grab; touch-action: none; }
.ws-item__grip .icon { width: 16px; height: 16px; }
.ws-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ws-item__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 600; }
.ws-item__meta { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12.5px; color: var(--muted); }
.ws-item__chevron { flex: none; width: 18px; height: 18px; color: var(--muted); }
.ws-item.is-done .ws-badge { opacity: .55; }
.ws-item.is-done .ws-item__name { color: var(--text-2); }
.ws-fold {
    display: flex; align-items: center; gap: 6px; margin: 12px 0 4px; padding: 6px 4px;
    font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
    background: none; border: 0;
}
.ws-fold:hover { color: var(--text-2); }
.ws-fold__icon { width: 14px; height: 14px; transform: rotate(-90deg); transition: transform .15s; }
.ws-fold[aria-expanded="true"] .ws-fold__icon { transform: none; }

/* pastilles de personnes */
.ws-face {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 999px;
    font-size: 13px; font-weight: 700; color: #fff;
}
.ws-faces { flex: none; display: flex; }
.ws-faces .ws-face { width: 24px; height: 24px; font-size: 11px; border: 2px solid var(--surface); }
.ws-faces .ws-face + .ws-face { margin-left: -8px; }
.ws-face--more { color: var(--text-2); background: var(--surface-2); }
.ws-item:hover .ws-faces .ws-face { border-color: var(--surface-2); }

/* niveau 2 : fiche d'un espace */
.ws-hero { display: flex; align-items: center; gap: 14px; padding: 4px 0 18px; }
.ws-hero .ws-badge { width: 44px; height: 44px; font-size: 20px; border-radius: 12px; }
.ws-hero__main { flex: 1; min-width: 0; }
.ws-hero__meta { margin: 2px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ws-title { min-height: 38px; display: flex; align-items: center; }
.ws-title__text, .ws-title__btn { font-size: 20px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.ws-title__btn {
    display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
    margin-left: -8px; padding: 4px 8px; text-align: left;
    background: none; border: 1px solid transparent; border-radius: 8px;
}
.ws-title__btn:hover { border-color: var(--border); }
.ws-title__pen { flex: none; width: 16px; height: 16px; color: var(--muted); }
.ws-title__input { width: 100%; font-size: 18px; font-weight: 700; }

.ws-section { padding: 16px 0; border-top: 1px solid var(--border); }
.ws-section__title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ws-section__count { padding: 1px 7px; font-size: 11px; color: var(--text-2); background: var(--surface-2); border-radius: 999px; }
.ws-section__count:empty { display: none; }
.ws-section__hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

.ws-input {
    min-width: 0; padding: 9px 12px; font: inherit; font-size: 14.5px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; outline: none;
}
.ws-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ws-invite { display: flex; gap: 8px; }
.ws-invite .ws-input { flex: 1; }
.ws-status { margin: 8px 0 0; font-size: 13px; color: var(--danger); }
.ws-status.is-ok { color: var(--accent); }
.ws-status:empty { display: none; }

.ws-people { margin: 10px 0 0; padding: 0; list-style: none; }
.ws-person { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 0; }
.ws-person + .ws-person { border-top: 1px solid var(--border); }
.ws-person--wait { color: var(--muted); font-size: 13px; }
.ws-person__email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ws-person__me { color: var(--muted); }
.ws-role { flex: none; padding: 4px 10px; font-size: 12.5px; font-weight: 500; color: var(--text-2); border-radius: 999px; }
.ws-role--admin { color: var(--accent); background: var(--accent-soft); }
.ws-role--btn { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; background: var(--surface-2); border: 1px solid transparent; }
.ws-role--btn:hover { color: var(--text); border-color: var(--border-strong); }
.ws-role__chevron { width: 14px; height: 14px; }

/* menu du rôle d'un membre */
.ws-rolemenu__title { margin: 0 0 8px; padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); overflow-wrap: anywhere; }
.ws-rolemenu__text { margin: 0 0 14px; padding: 0 6px; font-size: 13.5px; color: var(--text-2); }
.ws-rolemenu__foot { display: flex; justify-content: flex-end; gap: 8px; }
.ws-rolemenu__opt, .ws-rolemenu__act {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 8px; text-align: left; background: none; border: 0; border-radius: 8px;
}
.ws-rolemenu__opt:hover, .ws-rolemenu__act:hover { background: var(--surface-2); }
.ws-rolemenu__opt-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ws-rolemenu__opt-title { font-size: 14px; font-weight: 600; }
.ws-rolemenu__opt-help { font-size: 12.5px; color: var(--muted); }
.ws-rolemenu__check { flex: none; width: 18px; height: 18px; color: var(--accent); }
.ws-rolemenu__act { font-size: 14px; color: var(--text-2); }
.ws-rolemenu__act .icon { width: 17px; height: 17px; }
.ws-rolemenu__act--danger { color: var(--danger); }
.ws-rolemenu__act--danger:hover { background: var(--danger-soft); }

/* interrupteur « terminé » */
.ws-toggle { position: relative; display: flex; align-items: center; gap: 14px; cursor: pointer; }
.ws-toggle__text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ws-toggle__title { font-size: 14.5px; font-weight: 600; }
.ws-toggle__hint { font-size: 12.5px; color: var(--muted); }
.ws-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ws-switch-ui { flex: none; position: relative; width: 40px; height: 24px; background: var(--border-strong); border-radius: 999px; transition: background-color .15s; }
.ws-switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 999px; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.ws-switch-input:checked + .ws-switch-ui { background: var(--accent); }
.ws-switch-input:checked + .ws-switch-ui::after { transform: translateX(16px); }
.ws-switch-input:focus-visible + .ws-switch-ui { box-shadow: 0 0 0 3px var(--accent-soft); }

/* quitter / supprimer */
.ws-danger { padding-bottom: 4px; }
.ws-danger__btn { display: inline-flex; align-items: center; gap: 8px; margin-left: -8px; padding: 8px; font-size: 14px; font-weight: 500; color: var(--danger); background: none; border: 0; border-radius: 8px; }
.ws-danger__btn:hover { background: var(--danger-soft); }
.ws-danger__btn .icon { width: 17px; height: 17px; }
.ws-danger__note { margin: 0; font-size: 13px; color: var(--muted); }
.ws-danger__confirm { padding: 14px; background: var(--danger-soft); border-radius: 12px; }
.ws-danger__title { margin: 0 0 4px; font-weight: 700; }
.ws-danger__text { margin: 0; font-size: 13.5px; color: var(--text-2); }
.ws-danger__foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn--danger { color: var(--on-accent); background: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }

/* espace en lecture seule : pas de champs d'ajout, un bandeau l'explique */
.is-readonly .task.is-blank, .is-readonly .pad { display: none; }
.readonly-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 8px 12px;
    font-size: 13.5px;
    color: var(--text);
    background: var(--warning-soft);
    border-radius: 8px;
}
.readonly-note .icon { width: 16px; height: 16px; color: var(--warning); }

/* ========== Connexion ========== */
.is-signed-out .desk { display: none; }   /* rien de l'app n'est montré avant de savoir qui est connecté */
.has-auth { overflow: hidden; }
.auth {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 60; /* au-dessus des fiches (50), sous les messages (70) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    overflow-y: auto;
    background: var(--bg);
    /* petit quadrillage de cahier */
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 22px 22px;
}
.auth__card {
    position: relative;
    width: 100%;
    max-width: 380px;
    margin: auto;
    padding: 30px 26px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
/* morceau de scotch qui tient la feuille */
.auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.auth__title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auth__lead { margin: 4px 0 20px; color: var(--text-2); font-size: 14px; }
.auth__lead.is-notice { padding: 8px 10px; color: var(--text); background: var(--warning-soft); border-radius: 8px; }
.auth__field { margin-top: 14px; }
.auth__input {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px; /* 16px : iOS ne zoome pas sur le champ */
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}
.auth__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth__pw { position: relative; }
.auth__pw .auth__input { padding-right: 46px; }
.auth__eye {
    position: absolute;
    top: 0; right: 0;
    display: grid;
    place-items: center;
    width: 44px; height: 100%;
    color: var(--muted);
    border-radius: 0 8px 8px 0;
}
.auth__eye:hover { color: var(--text); }
.auth__eye .icon { width: 19px; height: 19px; }
.auth__hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.auth__error { min-height: 20px; margin: 10px 0 0; font-size: 13.5px; font-weight: 500; color: var(--danger); }
.auth__error:empty { min-height: 0; margin: 0; }
.auth__submit { justify-content: center; width: 100%; margin-top: 18px; padding: 11px 14px; font-size: 15px; font-weight: 600; }
.auth__submit:disabled { opacity: .7; cursor: default; }
.is-busy .auth__submit { cursor: progress; }
.auth__switch { margin: 16px 0 0; text-align: center; font-size: 13.5px; color: var(--text-2); }
.auth__link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* fenêtre de confirmation (déconnexion) */
.confirm__title { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.confirm__text { margin: 0; color: var(--text-2); }
.confirm__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ========== En-tête & pied de page ========== */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 16px;
    margin-bottom: 20px;
}
.page-title { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.page-date { margin: 0; color: var(--muted); font-size: 14px; }
.page-date::first-letter { text-transform: uppercase; }
/* lien "Comment ça marche ?" vers une vidéo explicative */
.video-link {
    display: inline-flex; align-items: center; gap: 6px; align-self: center;
    padding: 3px 10px 3px 3px; border-radius: 999px;
    color: var(--tab-themes); font-size: 12.5px; font-weight: 600; text-decoration: none;
    background: rgba(234, 88, 12, .12); /* repli si color-mix n'existe pas */
    transition: background .15s, transform .15s;
}
@supports (background: color-mix(in srgb, red 10%, transparent)) {
    .video-link { background: color-mix(in srgb, var(--tab-themes) 12%, transparent); }
    .video-link:hover { background: color-mix(in srgb, var(--tab-themes) 20%, transparent); }
}
.video-link:hover { transform: translateY(-1px); }
.video-link__play {
    display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
    color: #fff; background: var(--tab-themes);
}
.video-link__play .icon { width: 9px; height: 9px; margin-left: 1px; }
.page-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: 14px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 13px;
}
.page-nav { display: flex; align-items: center; gap: 2px; }

/* ========== Boutons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    transition: background-color .12s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn .icon { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn--ghost:hover { background: var(--danger-soft); }
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 8px;
    color: var(--muted);
    transition: color .12s, background-color .12s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn--sm { width: 30px; height: 30px; }
.icon-btn--sm .icon { width: 15px; height: 15px; }
.link-btn { color: var(--accent); font-size: 13px; font-weight: 500; padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { background: var(--accent-soft); }

/* ========== Listes & tâches ========== */
.lines { list-style: none; margin: 0; padding: 0; }
.task-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.line {
    position: relative;
    display: flex;
    align-items: flex-start;
    min-height: var(--row-h);
    border-bottom: 1px solid var(--border);
    touch-action: pan-y;
}
.lines > .line:last-child { border-bottom: 0; }
.task-list > .line { padding: 0 6px 0 2px; }
/* une ligne teintée ne déborde pas des coins arrondis de la liste */
.task-list > .line:first-child { border-top-left-radius: calc(var(--radius) - 1px); border-top-right-radius: calc(var(--radius) - 1px); }
.task-list > .line:last-child { border-bottom-left-radius: calc(var(--radius) - 1px); border-bottom-right-radius: calc(var(--radius) - 1px); }

.task__grip, .outcome__bullet {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: var(--row-h);
    color: var(--muted);
    cursor: grab;
    touch-action: none;
}
.task__grip .icon { width: 16px; height: 16px; }

.check {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: var(--row-h);
    color: var(--border-strong);
}
.check:hover { color: var(--accent); }
.check .icon { width: 21px; height: 21px; }
.check[aria-checked="true"] { --check-opacity: 1; --check-fill: var(--accent); --check-stroke: var(--accent); --check-color: var(--on-accent); }
.just-done .check .icon { animation: pop .3s ease-out; }

.task__pencil {
    flex: none;
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: var(--row-h);
    margin-left: 20px;
    color: var(--accent);
}
.task__body { position: relative; flex: 1; min-width: 0; padding-left: 6px; }

/* texte d'une ligne */
.task__text, .outcome__text {
    padding: var(--row-pad) 0;
    line-height: var(--row-lh);
    min-height: var(--row-h);
    color: var(--text);
    background-repeat: repeat-y;
    background-origin: content-box;
    background-clip: content-box;
}
/* priorité : ligne teintée, barre de couleur à gauche, case et drapeau colorés, texte en gras */
.task.is-highlighted:not(.is-done) { background: var(--hl-row); }
.task.is-highlighted::before {
    content: '';
    position: absolute;
    top: 7px; bottom: 7px; left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--hl-ink);
}
.task.is-highlighted .check { color: var(--hl-ink); }
.task.is-highlighted:not(.is-done) .task__text { font-weight: 600; }
.chip.chip--prio { color: var(--hl-ink); background: var(--hl); font-weight: 600; }
.is-done .chip--prio { display: none; }
.is-done.task.is-highlighted::before { opacity: .3; }
/* tâche terminée : rayée */
.is-done .task__text { color: var(--muted); }
.is-done .task__body::after {
    content: '';
    position: absolute;
    top: var(--row-pad); bottom: var(--row-pad); left: 6px;
    width: calc(var(--text-w, 100%) + 2px);
    max-width: calc(100% - 6px);
    pointer-events: none;
    background: linear-gradient(transparent calc(50% - 1px), var(--strike) calc(50% - 1px), var(--strike) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 100% var(--row-lh) repeat-y;
    transform-origin: left center;
}
.just-done .task__body::after { animation: strike .3s ease-out; }

/* méta-infos à droite (échéance, créneau, détails) */
.task__margin {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    height: var(--row-h);
    padding: 0 4px 0 8px;
    white-space: nowrap;
    color: var(--muted);
    border-radius: 8px;
}
.task__margin .icon { width: 16px; height: 16px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 18px;
    color: var(--text-2);
    background: var(--surface-2);
    border-radius: 999px;
}
.chip .icon { width: 13px; height: 13px; }
.chip--due.is-today { color: var(--warning); background: var(--warning-soft); }
.chip--due.is-late { color: var(--danger); background: var(--danger-soft); }
.task__erase { flex: none; height: var(--row-h); width: 32px; opacity: 0; }
.is-done .task__margin { opacity: .55; }

@media (hover: hover) {
    .task__grip, .outcome__bullet { opacity: 0; transition: opacity .12s; }
    .line:hover .task__grip, .line:hover .outcome__bullet, .outcome__bullet:focus { opacity: 1; }
    .line:hover .task__erase { opacity: 1; }
    .task__erase:hover { color: var(--danger); background: var(--danger-soft); }
    .task__margin:hover { background: var(--surface-2); }
    .outcomes .outcome__bullet { opacity: 1; }
}
@media (hover: none) {
    .task__erase { display: none; }
    .task__grip { opacity: .6; }
}

/* glisser vers la gauche = supprimer */
.line.is-swiping { background: linear-gradient(90deg, var(--surface), var(--danger-soft)); opacity: calc(1 - var(--swipe, 0) * .5); }

/* ========== Fiche (fenêtre de détails) ========== */
.sheet {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 17, 21, .45);
    animation: fade-in .15s ease-out;
    overflow-y: auto;
}
.sheet.is-leaving { animation: fade-out .15s ease-in forwards; pointer-events: none; }
.sheet__card {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 22px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    animation: card-in .18s ease-out;
}
.card__head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 -22px 6px;
    padding: 0 12px 10px 14px;
    border-bottom: 1px solid var(--border);
}
.card__head .check { height: 34px; }
.card__kicker { flex: 1; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.card__title { font-size: 20px; font-weight: 600; line-height: 1.35; padding: 8px 0; letter-spacing: -.01em; }
.card__desc {
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: 10px;
}
.card__desc .md { min-height: 76px; }
.card__desc .md-field__input { min-height: 76px; }
.card__section { margin-top: 18px; }
.card__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.card__foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
}

.field { display: block; }
.field__label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }

/* choix de priorité */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: background-color .12s, border-color .12s;
}
.swatch:hover { background: var(--surface-2); }
.swatch__ink { width: 12px; height: 12px; border-radius: 50%; background: var(--hl-ink); }
.swatch:first-child .swatch__ink { border: 1.5px dashed var(--muted); background: none; }
.swatch.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* ========== Section "Terminées" ========== */
.done-section { margin-top: 22px; }
.section-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 4px 8px 4px 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    border-radius: 6px;
}
.section-toggle:hover { background: var(--surface-2); }
.section-toggle__chev { width: 16px; height: 16px; transition: transform .15s; }
.done-section.is-open .section-toggle__chev { transform: rotate(90deg); }
.section-toggle__count { padding: 0 7px; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; }
.task-list--done { box-shadow: none; }

/* ========== Agenda ========== */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 16px; }
.cal-toolbar__title { flex: 1; min-width: 140px; margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 9px; }
.seg__btn { padding: 5px 11px; font-size: 13px; font-weight: 500; color: var(--text-2); border-radius: 7px; white-space: nowrap; }
.seg__btn:hover { color: var(--text); }
.seg__btn.is-on { color: var(--text); background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.seg--sm .seg__btn { padding: 4px 9px; font-size: 12.5px; }

.cal-view {
    --gutter: 52px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 124px);
    min-height: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.cal-head, .cal-allday, .cal-body { display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr); }
.cal-head {
    flex: none;
    grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}
.cal-dayhead { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; }
.cal-dayhead__name { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cal-dayhead__num {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    font-size: 19px; font-weight: 500;
    border-radius: 50%;
    transition: background-color .12s;
}
.cal-dayhead:hover .cal-dayhead__num { background: var(--surface-2); }
.cal-dayhead.is-today .cal-dayhead__name { color: var(--accent); }
.cal-dayhead.is-today .cal-dayhead__num { color: var(--on-accent); background: var(--accent); }

.cal-allday { flex: none; border-bottom: 1px solid var(--border); }
.cal-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; border-radius: 0 0 var(--radius) var(--radius); }
.cal-allday__grid { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); grid-auto-flow: row dense; gap: 2px; padding: 4px 2px; }
.cal-theme, .cal-late {
    overflow: hidden;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-decoration: none;
    border-radius: 5px;
}
.cal-theme { color: #fff; background: var(--tab-themes); }
.cal-late { color: var(--danger); background: var(--danger-soft); }

.cal-hours { position: relative; height: calc(24 * var(--hour)); }
.cal-hours__label {
    position: absolute;
    right: 8px;
    font-size: 11px;
    color: var(--muted);
    transform: translateY(-50%);
    font-variant-numeric: tabular-nums;
}
.cal-cols { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); }
.cal-col {
    position: relative;
    height: calc(24 * var(--hour));
    border-left: 1px solid var(--border);
    background-image: linear-gradient(var(--border) 1px, transparent 1px);
    background-size: 100% var(--hour);
    cursor: cell;
    -webkit-user-select: none;
    user-select: none;
}
.cal-col.is-today { background-color: var(--accent-soft); }

/* événements */
.ev {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    overflow: hidden;
    padding: 3px 6px;
    font-size: 12px;
    line-height: 1.3;
    color: var(--text);
    background: var(--surface);
    background-image: linear-gradient(var(--accent-soft), var(--accent-soft));
    border: 1px solid var(--surface);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    -webkit-touch-callout: none;
    touch-action: pan-y;
}
.ev:hover { z-index: 2; box-shadow: var(--shadow-lg); }
.ev.is-highlighted { background-image: linear-gradient(var(--hl), var(--hl)); border-left-color: var(--hl-ink); font-weight: 600; }
.ev--due { border-left-color: var(--warning); background-image: linear-gradient(var(--warning-soft), var(--warning-soft)); }
.ev--due.is-highlighted { background-image: linear-gradient(var(--hl), var(--hl)); border-left-color: var(--hl-ink); }
.ev.is-done { opacity: .55; }
.ev.is-done .ev__title { text-decoration: line-through; }
.ev__body { min-width: 0; flex: 1; }
.ev__title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ev__time { display: block; color: var(--text-2); font-size: 11px; }
.ev.is-short { align-items: center; }
.ev.is-short .ev__body { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.ev.is-short .ev__title { flex: 0 1 auto; min-width: 0; }
.ev.is-short .ev__time { flex: 0 100 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ev--due.is-short .ev__time { display: none; }
.ev__check { flex: none; display: flex; color: var(--warning); }
.ev__check .icon { width: 14px; height: 14px; }
.ev__check[aria-checked="true"] { --check-opacity: 1; --check-fill: var(--warning); --check-stroke: var(--warning); --check-color: #fff; }
.ev__resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.ev__resize::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 18px; height: 3px; margin-left: -9px; border-radius: 2px; background: currentColor; opacity: 0; }
.ev:hover .ev__resize::after { opacity: .3; }
.ev.is-moving { z-index: 6; opacity: .92; box-shadow: var(--shadow-lg); cursor: grabbing; }

.cal-sel {
    position: absolute;
    left: 2px; right: 4px;
    z-index: 3;
    padding: 3px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--on-accent);
    background: var(--accent);
    border-radius: 6px;
    opacity: .85;
    pointer-events: none;
}
.cal-now { position: absolute; left: -1px; right: 0; z-index: 3; height: 2px; background: var(--danger); pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

/* vue Mois */
.month { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.month__head, .month__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month__head { border-bottom: 1px solid var(--border); }
.month__wd { padding: 8px 0; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-align: center; text-transform: uppercase; color: var(--muted); }
.month__cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    min-height: 112px;
    padding: 4px 4px 6px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    cursor: cell;
}
.month__cell:nth-child(7n) { border-right: 0; }
.month__cell.is-out { background: var(--bg); }
.month__cell.is-out .month__num { color: var(--muted); }
.month__num {
    align-self: center;
    display: flex; align-items: center; justify-content: center;
    min-width: 26px; height: 26px;
    margin-bottom: 2px;
    font-size: 12.5px; font-weight: 500;
    border-radius: 999px;
}
.month__num:hover { background: var(--surface-2); }
.month__cell.is-today .month__num { color: var(--on-accent); background: var(--accent); }
.month__item {
    overflow: hidden;
    padding: 1px 6px;
    font-size: 12px;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-radius: 4px;
    background: var(--accent-soft);
}
.month__item--due { background: var(--warning-soft); }
.month__item.is-done { opacity: .55; text-decoration: line-through; }
.month__time { font-weight: 600; color: var(--text-2); }
.month__more { padding: 1px 6px; font-size: 12px; font-weight: 600; text-align: left; color: var(--text-2); }

/* création rapide */
.pop-layer { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 65; display: flex; align-items: flex-end; background: rgba(15, 17, 21, .3); }
.pop-layer.is-anchored { display: block; background: transparent; }
.pop-layer.is-anchored .pop { position: fixed; width: 320px; border-radius: 14px; }
.pop {
    width: 100%;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-lg);
    animation: card-in .14s ease-out;
}
.pop-layer.is-anchored .pop { padding-bottom: 14px; }
.qc__when { margin-bottom: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.qc__input { width: 100%; padding: 6px 0; font-size: 17px; font-weight: 600; border-bottom: 2px solid var(--accent); }
.qc__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }

/* ========== Thèmes ========== */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.sheet-paper {
    position: relative;
    padding: 18px 16px 6px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--tab-themes);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
/* poignée pour déplacer la carte */
.tape {
    position: absolute;
    top: 6px; left: 50%;
    width: 36px; height: 4px;
    margin-left: -18px;
    border-radius: 999px;
    background: var(--border-strong);
    cursor: grab;
    touch-action: none;
}
.tape::before { content: ''; position: absolute; top: -8px; bottom: -10px; left: -20px; right: -20px; }
.theme__head { display: flex; align-items: flex-start; gap: 4px; }
.theme__title { flex: 1; padding: 4px 0; font-size: 18px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.theme__period { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 2px 0 8px; font-size: 13px; color: var(--muted); }
.theme__desc { margin: 0 -6px 6px; padding: 2px 6px; font-size: 14px; color: var(--text-2); border-radius: 8px; }
.theme__desc:hover:not(.is-editing) { background: var(--surface-2); }
.theme__sub { margin: 14px 0 0; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.outcomes .outcome__bullet { color: var(--tab-themes); }
.outcomes .is-blank .outcome__bullet { color: var(--muted); }
.outcome__text { flex: 1; padding-left: 6px; font-size: 14px; }
.theme--blank {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 150px;
    padding: 16px 18px;
    color: var(--muted);
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    transition: border-color .12s;
}
.theme--blank:focus-visible, .theme--blank:hover { border-color: var(--accent); }
.theme--blank__plus { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); }
.theme--blank { font-size: 14px; font-weight: 500; cursor: pointer; }
.theme--blank:hover { color: var(--accent); }
.theme--new { display: flex; flex-direction: column; gap: 6px; min-height: 150px; border-top-color: var(--accent); }
.theme--new__label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.theme--new .theme__title { flex: none; border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.theme--new__hint { font-size: 12px; color: var(--muted); }

/* ========== Notes ========== */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.postit, .pad {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 150px;
    padding: 14px 16px;
    text-align: left;
    border-radius: var(--radius);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.postit {
    color: var(--note-text);
    background: var(--note);
    border: 1px solid var(--border);
    box-shadow: inset 0 3px 0 var(--note-edge), var(--shadow);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.postit:hover { transform: translateY(-2px); box-shadow: inset 0 3px 0 var(--note-edge), var(--shadow-lg); }
.postit__title { font-size: 15px; font-weight: 600; line-height: 1.35; word-break: break-word; }
.postit__text {
    max-height: 9em;
    overflow: hidden;
    font-size: 13.5px;
    color: var(--text-2);
    word-break: break-word;
    -webkit-mask-image: linear-gradient(#000 70%, transparent);
    mask-image: linear-gradient(#000 70%, transparent);
}
.md--preview a, .md--preview input { pointer-events: none; }
.pad {
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    border: 1.5px dashed var(--border-strong);
    transition: color .12s, border-color .12s;
}
.pad:hover { color: var(--accent); border-color: var(--accent); }
.pad__plus { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); }
.pad__plus .icon { width: 20px; height: 20px; }

/* note ouverte */
.postit-edit {
    display: flex;
    flex-direction: column;
    min-height: min(540px, 80vh);
    padding-top: 18px;
    color: var(--note-text);
    background: var(--note);
    box-shadow: inset 0 3px 0 var(--note-edge), var(--shadow-lg);
}
.sheet__card.postit-edit {
    max-width: 680px;
    height: min(88vh, 1000px);
    max-height: none;
    overflow: hidden;
    padding: 20px 0 0;
}
.postit-edit__head { flex: none; display: flex; align-items: center; gap: 12px; padding: 0 24px 10px 28px; }
.postit-edit__title { flex: 1; min-width: 0; padding: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.postit-edit__text {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 28px 20px;
    font-size: 15px;
}
.postit-edit__text .md, .postit-edit__text .md-field__input { flex: 1 0 auto; min-height: 100%; }
.postit-edit__text .md-field__hint { position: -webkit-sticky; position: sticky; bottom: -20px; padding: 6px 0; background: var(--note); }
.postit-edit .card__foot { flex: none; margin: 0; padding: 12px 22px; border-top: 1px solid rgba(127, 127, 127, .2); }
.postit-edit .btn:not(.btn--primary):not(.btn--ghost) { background: transparent; }

/* ========== Markdown ========== */
.md { line-height: 1.55; word-break: break-word; cursor: text; outline: none; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre { margin: 0 0 .6em; }
.md h1, .md h2, .md h3 { margin: .8em 0 .35em; line-height: 1.3; letter-spacing: -.01em; color: var(--text); }
.md h1 { font-size: 1.35em; }
.md h2 { font-size: 1.18em; }
.md h3 { font-size: 1.02em; }
.md ul, .md ol { padding-left: 1.4em; }
.md li { margin: .15em 0; }
.md li.md-task { list-style: none; margin-left: -1.4em; display: flex; align-items: flex-start; gap: 8px; }
.md-task input { flex: none; width: 16px; height: 16px; margin: .2em 0 0; accent-color: var(--accent); cursor: pointer; }
.md-task.is-checked > span { color: var(--muted); text-decoration: line-through; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
/* couleurs translucides : lisibles sur fond blanc, sur les notes colorées et en mode nuit */
.md code {
    padding: 1px 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88em;
    background: rgba(127, 127, 127, .14);
    border-radius: 4px;
}
.md pre {
    padding: 12px 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    line-height: 1.5;
    background: rgba(127, 127, 127, .12);
    border: 1px solid rgba(127, 127, 127, .2);
    border-radius: 8px;
    tab-size: 4;
}
.md pre code { padding: 0; font-size: .86em; white-space: pre; background: none; }
.md blockquote {
    padding: 6px 12px;
    color: var(--text-2);
    font-style: italic;
    background: rgba(127, 127, 127, .07);
    border-left: 3px solid var(--accent);
    border-radius: 0 6px 6px 0;
}
.md hr { height: 0; margin: 1.1em 0; border: 0; border-top: 2px solid rgba(127, 127, 127, .32); }
.md-empty { color: var(--muted); }
.md-img { display: block; margin: .3em 0; }
.md-img.is-broken {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12.5px;
    color: var(--text-2);
    text-decoration: none;
    border: 1px dashed rgba(127, 127, 127, .5);
    border-radius: 6px;
    word-break: break-all;
}
.md img { display: block; max-width: 100%; max-height: 420px; height: auto; border-radius: 8px; }
.md-table { margin: 0 0 .6em; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.md table { width: 100%; border-collapse: collapse; font-size: .93em; }
.md th, .md td { padding: 6px 10px; text-align: left; border: 1px solid rgba(127, 127, 127, .28); }
.md th { font-weight: 600; background: rgba(127, 127, 127, .12); }
.md tbody tr:nth-child(even) td { background: rgba(127, 127, 127, .05); }
.md--preview img { max-height: 90px; }


/* champ Markdown : rendu <-> écriture */
.md-field__input { display: none; line-height: 1.55; }
.md-field.is-editing .md { display: none; }
.md-field.is-editing .md-field__input { display: block; }
.md-field__hint { display: none; margin-top: 6px; font-size: 11.5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-spacing: 2px; }
.md-field.is-editing .md-field__hint { display: block; }

/* ========== Choix de date (picker) ========== */
.picker-field { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.picker-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.picker-field__btn {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 10px;
    font-size: 14px;
    text-align: left;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.picker-field__btn .icon { width: 16px; height: 16px; color: var(--muted); }
.picker-field:not(.has-value) .picker-field__text { color: var(--muted); }
.picker-field:not(.has-value) .picker-field__clear { display: none; }
.picker-field__clear { margin-right: 3px; }
/* version compacte (période d'un thème) */
.picker-field--compact { display: inline-flex; border: 0; background: var(--surface-2); border-radius: 6px; }
.picker-field--compact .picker-field__btn { min-height: 26px; padding: 0 8px; font-size: 13px; color: var(--text-2); }
.picker-field--compact .picker-field__clear { width: 22px; height: 22px; margin: 0 2px 0 -4px; }
.picker-field--compact .picker-field__clear .icon { width: 12px; height: 12px; }

.picker-layer {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 17, 21, .3);
    animation: fade-in .12s ease-out;
}
.picker-layer.is-popover { display: block; padding: 0; background: transparent; }
.picker-layer.is-popover .picker { position: fixed; }
.picker {
    width: 316px;
    max-width: 100%;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    animation: card-in .14s ease-out;
}
.picker__title { padding: 2px 4px 8px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.picker__quick { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.picker__chip {
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    background: var(--surface-2);
    border-radius: 999px;
    transition: background-color .12s, color .12s;
}
.picker__chip:hover { color: var(--accent); background: var(--accent-soft); }
.picker__chip--sm { padding: 3px 8px; font-size: 12px; }
.cal { padding-top: 8px; }
.cal__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal__title { font-size: 14px; font-weight: 600; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal__wd { padding: 4px 0; font-size: 11px; font-weight: 600; text-align: center; color: var(--muted); }
.cal__day {
    height: 36px;
    font-size: 13.5px;
    border-radius: 8px;
    color: var(--text);
    transition: background-color .1s;
}
.cal__day:hover { background: var(--surface-2); }
.cal__day.is-out { color: var(--muted); }
.cal__day.is-today { color: var(--accent); font-weight: 700; }
.cal__day.is-selected { color: var(--on-accent); background: var(--accent); font-weight: 600; }
.picker__time {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}
.picker__time-input {
    width: 68px;
    padding: 5px 8px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
}
.picker__time-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.picker__time-input.is-invalid { border-color: var(--danger); }
.picker__times { display: flex; flex-wrap: wrap; gap: 4px; }
.picker__foot { display: flex; justify-content: space-between; margin-top: 12px; }

/* ========== Messages ========== */
.toasts {
    position: fixed;
    left: 0; right: 0; bottom: 24px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 100%;
    padding: 10px 10px 10px 16px;
    font-size: 14px;
    color: var(--bg);
    background: var(--text);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in .2s ease-out;
}
.toast.is-leaving { animation: fade-out .2s ease-in forwards; }
.toast__action { padding: 4px 8px; font-weight: 600; border-radius: 6px; text-decoration: underline; text-underline-offset: 3px; }
.toast__action:hover { background: rgba(127, 127, 127, .2); }

/* ========== Glisser-déposer ========== */
.drag-ghost {
    position: fixed !important;
    top: 0; left: 0;
    z-index: 100;
    margin: 0;
    pointer-events: none;
    list-style: none;
    border-radius: 8px;
    box-shadow: var(--shadow-lg) !important;
}
.line.drag-ghost { background: var(--surface); border: 1px solid var(--border); }
.drag-origin { opacity: .25; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }

/* ========== Animations ========== */
@keyframes pop { 50% { transform: scale(1.2); } }
@keyframes strike { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes card-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
/* gommer (tâche, résultat) */
@keyframes erase { to { opacity: 0; transform: translateX(-24px); } }
/* déchirer (thème) */
@keyframes tear { to { opacity: 0; transform: translateY(10px) scale(.96); } }
/* froisser (note) */
@keyframes crumple { to { opacity: 0; transform: scale(.82) rotate(-4deg); } }
.is-erased { animation: erase .25s ease-in forwards; }
.is-torn { animation: tear .25s ease-in forwards; }
.is-crumpled { animation: crumple .25s ease-in forwards; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ========== Tablette : barre latérale réduite aux icônes ========== */
@media (max-width: 1080px) and (min-width: 721px) {
    .tabs { width: 68px; padding: 18px 10px; align-items: center; }
    .brand { padding: 2px 0 20px; }
    .brand span, .tab__label { display: none; }
    .ws-switch { justify-content: center; width: 44px; padding: 8px 0; background: transparent; border-color: transparent; }
    .ws-switch__text, .ws-switch__chevron { display: none; }
    .ws-share { display: none; }
    .tab__chevron { display: none; }
    .tab { justify-content: center; width: 44px; height: 44px; padding: 0; }
    .page { padding: 28px 28px 80px; }
}

/* ========== Mobile : barre d'onglets en bas ========== */
@media (max-width: 720px) {
    .desk { display: block; }
    .page { padding: max(18px, env(safe-area-inset-top)) 14px calc(88px + env(safe-area-inset-bottom)); }
    .page-title { font-size: 24px; }
    .page-head { margin-bottom: 14px; }

    .tabs {
        position: fixed;
        top: auto; left: 0; right: 0; bottom: 0;
        flex-direction: row;
        justify-content: space-around;
        width: auto;
        height: auto;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        border-right: 0;
        border-top: 1px solid var(--border);
    }
    .brand { display: none; }
    .ws-slot--side { display: none; }
    .ws-slot--top { display: block; padding: max(12px, env(safe-area-inset-top)) 14px 0; }
    .ws-slot--top .ws-switch { width: auto; max-width: 100%; padding: 5px 10px 5px 6px; border-radius: 999px; }
    .ws-slot--top .ws-badge { width: 22px; height: 22px; font-size: 12px; border-radius: 999px; }
    .ws-slot--top .ws-bar { justify-content: space-between; }
    .ws-slot--top .ws-bar .ws-switch { flex: 0 1 auto; }
    .ws-slot--top .ws-share { width: auto; height: 34px; padding: 0 12px 0 10px; border-radius: 999px; }
    .ws-slot--top .ws-share .icon { width: 16px; height: 16px; }
    .ws-slot--top .ws-share__text { display: inline; }
    .ws-slot--top + .page { padding-top: 12px; } /* la marge du haut est déjà prise par le sélecteur */
    .tab {
        flex: 1;
        min-width: 0;
        flex-direction: column;
        gap: 3px;
        padding: 6px 2px;
        font-size: 11px;
        font-weight: 500;
        border-radius: 10px;
    }
    .tab:hover, .tab.is-active { background: transparent; }
    .tab.is-active { color: var(--tab-color); font-weight: 600; }
    .tab__icon { width: 22px; height: 22px; }
    .tab__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .tab--tool { flex: 0 0 48px; margin: 0; }
    .tab--tool .tab__label { display: none; }
    .tab--profile { flex: 1; }
    .tab--profile .tab__label--email, .tab--profile .tab__chevron { display: none; }
    .tab--profile .tab__label--short { display: block; }
    .tab--profile .ws-face.tab__avatar { width: 22px; height: 22px; font-size: 11px; }

    .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }

    .task__margin { max-width: 46%; overflow: hidden; padding-left: 4px; }
    .margin__long { display: none; }

    /* la fiche monte du bas de l'écran */
    .sheet { align-items: flex-end; padding: 0; }
    .sheet__card {
        max-width: none;
        max-height: 94vh;
        border-radius: 16px 16px 0 0;
        border-bottom: 0;
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
        animation-name: sheet-up;
    }
    .sheet__card.postit-edit { height: 94vh; border-radius: 16px 16px 0 0; padding-top: 18px; }
    .postit-edit__head { padding: 0 14px 8px 18px; }
    .postit-edit__text { padding: 4px 18px 16px; }
    .postit-edit .card__foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
    .themes { grid-template-columns: 1fr; }
    .board { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .postit, .pad { min-height: 130px; }
    .cal-view { --gutter: 40px; margin: 0 -8px; border-radius: 10px; height: calc(100vh - 200px - env(safe-area-inset-bottom)); }
    .cal-toolbar { gap: 6px 8px; }
    .cal-toolbar__title { order: -1; flex-basis: 100%; font-size: 20px; }
    .cal-dayhead__num { width: 30px; height: 30px; font-size: 16px; }
    .ev { padding: 2px 4px; font-size: 11px; }
    .month__cell { min-height: 84px; padding: 2px 1px 4px; }
    .month__item { padding: 0 3px; font-size: 10.5px; }
    .month__time { display: none; }

    .picker-layer { align-items: flex-end; padding: 0; }
    .picker {
        width: 100%;
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
        border-radius: 16px 16px 0 0;
        animation-name: sheet-up;
    }
    .cal__day { height: 42px; font-size: 15px; }
}

/* ========== Retour / signalement de bug ========== */
.fb-sheet { max-width: 520px; }
.fb-form { position: relative; }
.fb-form.is-dropping::after {
    content: 'Déposer les images ici';
    position: absolute; inset: -4px; z-index: 2;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; color: var(--accent);
    background: var(--surface); /* repli si color-mix n'existe pas */
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    border: 2px dashed var(--accent); border-radius: 12px;
    pointer-events: none;
}
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -10px 0 0; }
.fb-head__title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.fb-lead { margin: 4px 0 16px; color: var(--text-2); font-size: 14px; }
.fb-label { display: block; margin: 14px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.fb-label__opt { font-weight: 400; color: var(--muted); }
.fb-input {
    display: block; width: 100%; padding: 10px 12px;
    font: inherit; font-size: 15px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; outline: none;
}
.fb-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fb-textarea { min-height: 96px; resize: vertical; overflow: auto; line-height: 1.45; }
.fb-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.fb-drop {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 12px 14px; text-align: left;
    color: var(--text-2); background: var(--surface-2);
    border: 1.5px dashed var(--border-strong); border-radius: 12px;
}
.fb-drop:hover { color: var(--accent); border-color: var(--accent); }
.fb-drop[hidden] { display: none; }
.fb-drop__icon { flex: none; width: 26px; height: 26px; }
.fb-drop__text { display: flex; flex-direction: column; gap: 1px; }
.fb-drop__title { font-size: 14px; font-weight: 600; color: var(--text); }
.fb-drop__hint { font-size: 12.5px; color: var(--muted); }

.fb-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.fb-thumbs:not(:empty) { margin-bottom: 10px; }
.fb-thumb { position: relative; width: 104px; height: 78px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.fb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fb-thumb.is-busy img { opacity: .45; }
.fb-thumb.is-error { border-color: var(--danger); }
.fb-thumb.is-error img { opacity: .3; }
.fb-thumb__note { position: absolute; left: 6px; right: 6px; bottom: 5px; font-size: 11px; font-weight: 600; line-height: 1.2; color: var(--text); }
.fb-thumb.is-error .fb-thumb__note { color: var(--danger); }
.fb-thumb__remove {
    position: absolute; top: 4px; right: 4px;
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; color: #fff; background: rgba(15, 17, 21, .6); border: 0; border-radius: 999px;
}
.fb-thumb__remove:hover { background: rgba(15, 17, 21, .85); }
.fb-thumb__remove .icon { width: 14px; height: 14px; }

.fb-tech { margin-top: 14px; }
.fb-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.fb-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.fb-tech__details { margin: 4px 0 0 24px; font-size: 12.5px; color: var(--muted); }
.fb-tech__details summary { cursor: pointer; }
.fb-tech__text { margin: 6px 0 0; padding: 8px 10px; font: 11.5px/1.45 ui-monospace, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 8px; }

.fb-error { margin: 12px 0 0; font-size: 13.5px; color: var(--danger); }
.fb-error:empty { display: none; }
.fb-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.fb-foot--center { justify-content: center; flex-wrap: wrap; }

.fb-mine:not(:empty) { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.fb-mine__details summary { font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.fb-mine__list { margin: 8px 0 0; padding: 0; list-style: none; }
.fb-mine__item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; }
.fb-mine__item + .fb-mine__item { border-top: 1px solid var(--border); }
.fb-mine__title { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.fb-mine__date { font-size: 12px; color: var(--muted); }
.fb-mine__imgs { display: flex; gap: 6px; flex-basis: 100%; }
.fb-mine__imgs img { width: 56px; height: 42px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; }

.fb-thanks { padding: 24px 4px 8px; text-align: center; }
.fb-thanks__icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-bottom: 10px; color: var(--on-accent); background: var(--accent); border-radius: 999px; }
.fb-thanks__icon .icon { width: 26px; height: 26px; }

/* ========== Maintenance du serveur (bandeau) ========== */
.maintenance {
    position: fixed; z-index: 62; /* au-dessus de l'écran de connexion (60), sous les messages (70) */
    top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px;
    width: min(560px, calc(100% - 24px));
    padding: 12px 14px;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--warning); border-left-width: 4px; border-radius: 12px;
    box-shadow: var(--shadow-lg);
    animation: card-in .18s ease-out;
}
.maintenance__icon { flex: none; display: flex; color: var(--warning); }
.maintenance__icon .icon { width: 22px; height: 22px; }
.maintenance__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.maintenance__text span { color: var(--text-2); overflow-wrap: anywhere; }
.maintenance__retry {
    flex: none; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px;
}
.maintenance__retry:disabled { opacity: .6; }
/* la page commence sous le bandeau (hauteur mesurée en JS : --maintenance-h) */
.is-maintenance .page { padding-top: calc(var(--maintenance-h, 72px) + 24px); }
@media (max-width: 720px) {
    .maintenance__retry { padding: 6px 10px; }
    .is-maintenance .page { padding-top: 12px; }
    .is-maintenance .ws-slot--top { padding-top: calc(var(--maintenance-h, 90px) + 20px); }
}

/* ========== Quoi de neuf ========== */
.news-sheet { max-width: 560px; }
.news-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-right: -10px; }
.news-head__title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.news-lead { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.news { margin: 16px 0 0; padding: 0; list-style: none; }
.news__item { padding: 14px 0; border-top: 1px solid var(--border); }
.news__item:first-child { border-top: 0; padding-top: 4px; }
.news__meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.news__version { padding: 1px 8px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; }
.news__title { margin: 6px 0 4px; font-size: 16px; font-weight: 700; }
.news__text { font-size: 14px; color: var(--text-2); cursor: auto; }
.news__text p { margin: 0 0 8px; }
.news__text ul, .news__text ol { margin: 6px 0 0; padding-left: 20px; }
.news__text li { margin: 3px 0; }
.news__text strong { color: var(--text); }
.news-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.news-foot__version { font-size: 12px; color: var(--muted); }

.profile-menu__version { margin: 6px 0 0; padding: 0 8px; font-size: 11.5px; color: var(--muted); }
