/* ------------------------------------------------------------------
   Project Manager — cartes claires sur fond gris, angles arrondis, un
   seul rouge. La hierarchie vient des surfaces et de la typographie :
   une carte porte un sujet, un filet ne separe que ce qui se ressemble.
   ------------------------------------------------------------------ */

:root {
    --paper: #ffffff;
    --canvas: #f4f5f7;
    --ink: #15171c;
    --ink-2: #5a6070;
    --ink-3: #8b91a0;

    --rule: #e6e8ec;   /* contour des cartes */
    --rule-2: #eef0f3; /* separations internes */
    --wash: #f2f3f6;   /* fond des pastilles et des survols */
    --wash-2: #f7f8fa;

    --accent: #e8341c;
    --ok-bg: #e7f5ee;
    --ok-ink: #157a4e;

    /* Couleur du projet courant ; le rouge reste la couleur des actions. */
    --key: #15171c;

    /* Le texte des taches : un gris d'encre, moins dur que le noir des titres. */
    --task: #2b2f38;

    --gutter: 28px;
    --r-lg: 16px;
    --r: 12px;
    --r-sm: 9px;
    --pill: 999px;
    --shadow: 0 1px 2px rgba(20, 23, 28, .04);
    --shadow-pop: 0 12px 34px rgba(20, 23, 28, .14), 0 2px 6px rgba(20, 23, 28, .06);

    --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --mono: "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", monospace;
}

/* ------------------------------------------------------------------
   Les etats d'une ligne. Ils ont leur propre palette, independante de
   celle du projet : « en cours » doit vouloir dire la meme chose d'un
   projet a l'autre, sinon la couleur n'apprend plus rien. Le projet se
   reconnait a son nom et a son bandeau, pas a l'etat de ses taches.
   ------------------------------------------------------------------ */
.st-doing   { --st: #1b6ef3; }  /* bleu   : on est dessus */
.st-waiting { --st: #ef8a02; }  /* orange : en pause */
.st-blocked { --st: #7c3aed; }  /* violet : bute sur autre chose */
.st-review  { --st: #0d9488; }  /* teal   : attend un oeil */
.st-dropped { --st: #e03131; }  /* rouge  : ne sera pas faite */

/* Aplats francs : une couleur identifie un projet, comme une ligne de metro. */
.k-red    { --key: #e8341c; }
.k-blue   { --key: #1b4de4; }
.k-yellow { --key: #f0a500; }
.k-green  { --key: #00875a; }
.k-orange { --key: #ef6602; }
.k-violet { --key: #6b2fd6; }
.k-ink    { --key: #15171c; }
.k-grey   { --key: #8a8a8a; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "tnum" 1, "cv05" 1;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: #ffd9d3; color: var(--ink); }

/* ---------- ossature ---------- */

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap.wide { max-width: 1560px; }

main { padding-bottom: 96px; }

.card {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
}

.label { font-size: 14px; font-weight: 650; color: var(--ink); }

.hint { font-size: 12px; color: var(--ink-3); }

/* Pastille de comptage : le chiffre se lit sans lire le reste. */
.chip {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: var(--r-sm);
    background: var(--wash);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 550;
    font-variant-numeric: tabular-nums;
}

/* Etat d'un projet : en cours, ou range. */
.pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: var(--pill);
    background: var(--ok-bg);
    color: var(--ok-ink);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.pill.off { background: var(--wash); color: var(--ink-3); }

kbd, .kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--paper);
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-2);
}

/* ---------- barre du haut ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--rule);
}
.topbar-in {
    max-width: 1560px;
    margin: 0 auto;
    padding: 0 var(--gutter);
    height: 62px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 420px) minmax(0, 1fr);
    align-items: center;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.01em;
    justify-self: start;
}
.brand .mark {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

/* La recherche est un bouton : la saisie se fait dans la palette. */
.srch {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    height: 38px;
    padding: 0 8px 0 12px;
    border: 1px solid transparent;
    border-radius: var(--pill);
    background: var(--wash);
    color: var(--ink-3);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}
.srch:hover { background: #edeff3; }
.srch span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srch .kbds { display: flex; gap: 3px; flex: 0 0 auto; }
.srch svg { flex: 0 0 auto; }

.tabs { display: flex; align-items: center; gap: 4px; justify-self: end; }
.tabs a {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-2);
}
.tabs a:hover { background: var(--wash); color: var(--ink); }
.tabs a.on { background: var(--wash); color: var(--ink); font-weight: 600; }

/* ---------- boutons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--paper);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--wash-2); border-color: #dcdfe5; }
.btn.danger { color: #c9331d; }
.btn.danger:hover { background: #fdf3f1; border-color: #f3d2cb; }
.btn.solid { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.solid:hover { background: #000; border-color: #000; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--wash); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn:disabled:hover { background: var(--paper); border-color: var(--rule); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Segmente : un seul choix, trois etats, pas de menu a ouvrir. */
.seg {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: var(--r-sm);
    background: var(--wash);
}
.seg button {
    border: 0;
    background: transparent;
    height: 26px;
    padding: 0 11px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-3);
    cursor: pointer;
}
.seg button:hover { color: var(--ink); }
.seg button.on {
    background: var(--paper);
    color: var(--ink);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(20, 23, 28, .08);
}

/* ---------- titre de page ---------- */

.page-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 20px;
    padding: 34px 0 18px;
}
.page-head h1 { font-size: 28px; letter-spacing: -0.025em; font-weight: 700; }
.lede {
    margin: 8px 0 0;
    max-width: 62ch;
    font-size: 14px;
    color: var(--ink-2);
}
.lede a { color: var(--ink); font-weight: 500; }
.lede a:hover { color: var(--accent); }

/* ---------- saisie ---------- */

.newline {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    padding: 0 8px 0 16px;
    border: 1px solid var(--rule);
    border-radius: var(--r);
    background: var(--paper);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.newline:focus-within { border-color: #d3d7de; box-shadow: 0 0 0 3px rgba(20, 23, 28, .04); }
.newline input[type="text"] {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 14.5px;
    outline: none;
}
.newline input::placeholder { color: var(--ink-3); }
.newline button {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: var(--r-sm);
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
}
.newline button:hover { background: #000; }

/* Creation d'une page : une ligne de liste, pas un formulaire. */
.newline.compact {
    height: 34px;
    margin: 2px 8px 10px;
    padding: 0 6px 0 10px;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}
.newline.compact::before {
    content: "+";
    color: var(--ink-3);
    font-size: 15px;
    line-height: 1;
}
.newline.compact input { font-size: 13.5px; }
.newline.compact button {
    width: 26px;
    height: 26px;
    padding: 0;
    justify-content: center;
    background: transparent;
    color: var(--ink-3);
    opacity: 0;
}
.newline.compact:hover { background: var(--wash-2); border-color: var(--rule-2); }
.newline.compact:focus-within { background: var(--paper); border-color: var(--rule); }
.newline.compact:focus-within button { opacity: 1; background: var(--ink); color: #fff; }

/* ---------- liste des projets ---------- */

.plist { overflow: hidden; }

.prow {
    position: relative;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 200px 74px 34px;
    align-items: center;
    gap: 0 18px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--rule-2);
    transition: background .1s linear;
}
.prow:last-child { border-bottom: 0; }
.prow:hover { background: var(--wash-2); }

/* Le lien couvre toute la ligne, en dessous : les boutons restent cliquables
   sans imbriquer un <button> dans un <a>, ce qui serait invalide. */
.prow-open { position: absolute; inset: 0; z-index: 0; }
.prow > *:not(.prow-open) { position: relative; z-index: 1; pointer-events: none; }
.prow .row-tools { pointer-events: auto; justify-content: flex-end; }

/* La vignette du projet : sa couleur, son initiale. */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--key);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.02em;
    flex: 0 0 auto;
}
.avatar.lg { width: 46px; height: 46px; border-radius: 14px; font-size: 21px; }

.prow h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.prow:hover h2 { color: var(--accent); }
.pmeta {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--ink-3);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
}
.pmeta .sep { color: #ccd0d8; }
.pmeta .path { font-family: var(--mono); font-size: 11.5px; }

/* En <span> dans une ligne de projet, en <div> dans l'entete : la jauge
   doit etre un bloc dans les deux cas, sinon sa hauteur est ignoree. */
.track {
    display: block;
    height: 6px;
    border-radius: var(--pill);
    background: var(--rule-2);
    position: relative;
    overflow: hidden;
}
.track i { position: absolute; inset: 0 auto 0 0; background: var(--key); border-radius: var(--pill); }
.tracknote { display: block; margin-top: 7px; font-size: 12px; color: var(--ink-3); }

.big {
    text-align: right;
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.big span { font-size: 13px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }

.prow.is-archived { opacity: .5; }

.empty { padding: 30px 18px; font-size: 13.5px; color: var(--ink-3); }

/* ---------- entete de projet ---------- */

.crumbs {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 20px 0 14px;
    font-size: 13px;
    color: var(--ink-3);
}
.crumbs a:hover { color: var(--ink); }
.crumbs em { font-style: normal; color: #ccd0d8; }
.crumbs [data-crumb] { color: var(--ink-2); }

.phead { padding: 22px 24px; }
.phead-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 460px);
    gap: 30px;
    align-items: start;
}
.phead-id { display: flex; align-items: flex-start; gap: 14px; }
.phead h1 {
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-weight: 700;
}
.phead-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phead .desc-edit {
    margin: 5px 0 0;
    max-width: 62ch;
    font-size: 14px;
    color: var(--ink-2);
}

.pstat { padding-top: 4px; }
.pstat-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}
.pstat .huge {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.pstat .huge span { font-size: 30px; }
.pstat .huge em { font-style: normal; font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-left: 6px; }
.pstat .tracknote { margin: 0; text-align: right; }
.pstat .track { margin-top: 12px; }

/* fiche technique du projet : ce que lit aussi l'agent */
.specs {
    margin: 20px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}
.spec {
    position: relative;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--r);
    padding: 9px 34px 9px 12px;
    min-width: 0;
}
.spec:hover { border-color: #dcdfe5; }
.spec dt {
    font-size: 9.5px;
    font-weight: 650;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 3px;
}
.spec dd {
    margin: 0;
    font-size: 12.5px;
    font-family: var(--mono);
    color: var(--ink);
    word-break: break-all;
}
.copy {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    opacity: 0;
}
.spec:hover .copy, .copy:focus-visible { opacity: 1; }

/* Ce bloc n'existe que pour etre copie : son bouton ne se cache pas. */
.snip .copy { opacity: .55; }
.snip:hover .copy, .snip .copy:hover { opacity: 1; }
.copy:hover { background: var(--wash); color: var(--ink); }

/* ---------- brancher un agent ---------- */

/* Ce qu'il faut donner a Claude pour qu'il travaille sur ce projet-ci. On ne
   le fait qu'une fois : le bloc reste replie, et se copie en deux clics. */
.hookup { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rule-2); }
.hookup summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 550;
    color: var(--ink-2);
    padding: 6px 10px;
    margin-left: -10px;
    border-radius: var(--r-sm);
}
.hookup summary::marker, .hookup summary::-webkit-details-marker { display: none; }
.hookup summary::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform .12s ease;
}
.hookup[open] summary::before { transform: rotate(90deg); }
.hookup summary:hover { background: var(--wash); color: var(--ink); }

.snips { display: grid; gap: 10px; margin-top: 10px; }

.snip {
    position: relative;
    background: var(--wash-2);
    border: 1px solid var(--rule-2);
    border-radius: var(--r);
    padding: 10px 42px 11px 13px;
}
.snip-head { margin: 0 0 7px; font-size: 11.5px; color: var(--ink-3); }
.snip-head b { color: var(--ink-2); font-weight: 550; }
.snip-head code { font-family: var(--mono); font-size: 11px; }
.snip pre {
    margin: 0;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
}
.snip-note { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.snip-note b { color: var(--ink-2); font-weight: 550; }

.phead-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--rule-2);
    flex-wrap: wrap;
}
.swatch-row { display: flex; align-items: center; gap: 10px; }
.swatch-row .cap { font-size: 13px; color: var(--ink-2); }
.swatches { display: flex; gap: 6px; }
.sw {
    width: 20px;
    height: 20px;
    border: 0;
    padding: 0;
    border-radius: var(--pill);
    background: var(--key);
    cursor: pointer;
}
.sw:hover { transform: scale(1.08); }
.sw.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--key); }

/* La neuvieme pastille : quatre quarts d'aplat, pas un degrade — et une fois
   une couleur choisie, elle porte simplement cette couleur. */
.sw-pick {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, #e8341c 0 50%, #00875a 50% 100%),
        linear-gradient(45deg, #1b4de4 0 50%, #f0a500 50% 100%);
    background-size: 100% 50%, 100% 50%;
    background-position: top, bottom;
    background-repeat: no-repeat;
}
.sw-pick.on { background: var(--key); }
.sw-pick input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}

.phead-tools { display: flex; align-items: center; gap: 8px; }

/* ---------- colonnes ---------- */

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
    margin-top: 20px;
}
@media (max-width: 1040px) {
    /* minmax(0, 1fr) et non 1fr : sinon la colonne refuse de descendre
       sous la largeur minimale de son contenu, et la page deborde. */
    .split { grid-template-columns: minmax(0, 1fr); }
}

.col-side { display: flex; flex-direction: column; gap: 16px; }

/* ---------- carte de l'editeur ---------- */

.panel { overflow: hidden; }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--rule-2);
    flex-wrap: wrap;
}
.panel-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-title .label { font-size: 15px; }
.panel-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.editor-state {
    font-size: 11.5px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    min-width: 58px;
    text-align: right;
}

.fontpick select {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--paper);
    font-size: 12.5px;
    color: var(--ink-2);
    outline: none;
    cursor: pointer;
    max-width: 148px;
}
.fontpick select:hover { background: var(--wash-2); color: var(--ink); }

.panel-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 18px;
    border-top: 1px solid var(--rule-2);
    background: var(--wash-2);
    font-size: 12px;
    color: var(--ink-3);
    flex-wrap: wrap;
}
.keys { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.keys span { margin-right: 8px; }
.foot-counts { display: flex; gap: 14px; white-space: nowrap; }

/* ---------- editeur ---------- */

.editor {
    position: relative;
    counter-reset: ln;
    font-family: var(--editor-font, var(--sans));
    font-size: 14px;
    line-height: 1.7;
    color: var(--task);
    padding: 16px 18px 56px 58px;
    min-height: 300px;
    cursor: text;
}

/* Gouttiere de numeros, comme dans un editeur de texte : une bande tenue a
   gauche, un filet, et le compte des lignes. Le numero est un compteur CSS —
   il se refait tout seul a chaque ligne ajoutee, enlevee ou masquee, et ne
   part jamais dans le presse-papier ni dans ce qu'on enregistre. */
.editor::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 46px;
    background: rgba(20, 23, 28, .025);
    border-right: 1px solid var(--rule-2);
    pointer-events: none;
}

.ln {
    position: relative;
    counter-increment: ln;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    margin: 0 -6px;
    padding: 1px 6px;
    border-radius: var(--r-sm);
}

.ln::before {
    content: counter(ln);
    position: absolute;
    left: -46px;
    top: 1px;
    width: 32px;
    text-align: right;
    font-family: var(--mono);
    font-size: 11px;
    line-height: 24px;
    color: #bcc1cb;
    font-variant-numeric: tabular-nums;
    user-select: none;
    pointer-events: none;
}
.ln:hover::before { color: var(--ink-3); }

/* Le marqueur d'etat a sa propre colonne, contre le bord gauche : il se pose
   devant le numero, il ne le remplace pas — on doit pouvoir lire le numero
   d'une ligne meme pendant qu'on travaille dessus. Rond, la ou la case carree
   ne parle que de ce qui est fait.

   Chaque etat a sa couleur ET sa forme : la couleur seule ne survit ni au
   daltonisme ni a une impression, et deux etats voisins doivent se distinguer
   du coin de l'oeil, sans lire l'etiquette. */
.now {
    position: absolute;
    left: -48px;
    top: 6px;
    width: 12px;
    height: 12px;
    padding: 0;
    border: 1.5px solid #c8ccd4;
    border-radius: var(--pill);
    background: var(--paper);
    cursor: pointer;
    opacity: 0;
    user-select: none;
}
.ln:hover .now { opacity: 1; }
.now:hover { border-color: var(--st, #1b6ef3); }

/* Des qu'un etat est pose, la pastille reste allumee, meme sans survol. */
.ln[data-state] .now { opacity: 1; border-color: var(--st); }

/* Le signe interieur, commun a tous les etats : c'est lui qui change de
   forme. Centre par translation, pour n'avoir a regler que sa taille. */
.ln[data-state] .now::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--st);
}

/* EN COURS — la pastille est aussi la jauge : un camembert qui se remplit.
   C'est le seul etat qui repond a « ou en est-on », et il ne doit surtout
   pas devenir un pictogramme comme les autres. */
.ln.is-working .now {
    background: conic-gradient(var(--st) calc(var(--p, 0) * 1%), transparent 0);
}
.ln.is-working .now::before { content: none; }

/* EN ATTENTE — deux barres de pause : ca dort, mais ca reprendra. */
.ln.st-waiting .now::before {
    width: 5px;
    height: 6px;
    background: none;
    border-left: 1.5px solid var(--st);
    border-right: 1.5px solid var(--st);
}

/* BLOQUEE — la barre du sens interdit. */
.ln.st-blocked .now::before {
    width: 7px;
    height: 1.5px;
    border-radius: 1px;
}

/* A VALIDER — un point plein : il y a quelque chose a regarder ici. */
.ln.st-review .now::before {
    width: 5px;
    height: 5px;
    border-radius: var(--pill);
}

/* ABANDONNEE — une croix. Le seul etat dont on ne revient pas tout seul. */
.ln.st-dropped .now::before,
.ln.st-dropped .now::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 1.5px;
    border-radius: 1px;
    background: var(--st);
}
.ln.st-dropped .now::before { transform: translate(-50%, -50%) rotate(45deg); }
.ln.st-dropped .now::after { transform: translate(-50%, -50%) rotate(-45deg); }

.ln.k-line .now { display: none; }

.pct {
    display: none;
    flex: 0 0 auto;
    align-self: center;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: var(--pill);
    background: color-mix(in srgb, var(--st) 12%, transparent);
    color: var(--st);
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    user-select: none;
}
.ln[data-state] .pct { display: inline-flex; }
.ln:hover { background: var(--wash-2); }
.ln:focus-within { background: transparent; }

/* Connecteurs d'arbre : une colonne par niveau, tracee au filet. Le trait
   horizontal se pose a hauteur de la premiere ligne de texte, pour rester
   juste meme quand le libelle passe a la ligne. */
/* align-self: stretch, sinon la colonne se replie sur ses <i> vides et les
   filets verticaux n'ont plus aucune hauteur a occuper. */
.guides { display: flex; flex: 0 0 auto; align-self: stretch; user-select: none; }

/* Une colonne par niveau. Elle est plus large que « case + espace » pour
   qu'un enfant commence franchement a droite du texte de son parent. */
.g { position: relative; width: 26px; align-self: stretch; }

.g-line::before, .g-tee::before, .g-end::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 0;
    border-left: 1px solid #dee1e6;
}
.g-line::before, .g-tee::before { bottom: 0; }
.g-end::before { height: 12px; }

/* Le trait horizontal va jusqu'au bord de la colonne : il touche la case,
   sans tiret flottant au milieu de nulle part. */
.g-tee::after, .g-end::after {
    content: "";
    position: absolute;
    left: 7px;
    right: 0;
    top: 12px;
    border-top: 1px solid #dee1e6;
}

/* Gouttiere : la poignee de deplacement et le chevron de repli. Largeur
   fixe, pour que rien ne bouge quand ils apparaissent au survol. */
.grip, .fold {
    flex: 0 0 auto;
    width: 14px;
    color: #c3c7cf;
    opacity: 0;
    user-select: none;
    line-height: 1.6;
    font-size: 11px;
    text-align: center;
}
.grip { margin-left: 2px; cursor: grab; }
.fold {
    margin-right: 2px;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.fold::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 4.5px solid currentColor;
    border-top: 3.5px solid transparent;
    border-bottom: 3.5px solid transparent;
    transform: rotate(90deg);
    transition: transform .12s ease;
}
.ln:hover .grip { opacity: 1; }
.ln.has-kids:hover .fold, .ln.is-folded .fold { opacity: 1; }
.ln.is-folded .fold::before { transform: rotate(0deg); }
.fold:hover { color: var(--ink-2); }
.ln:not(.has-kids) .fold { pointer-events: none; }
.ln.is-collapsed { display: none; }

body.dragging, body.dragging * { cursor: grabbing !important; }

.box {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 4px 9px 0 0;
    border: 1.5px solid #c8ccd4;
    border-radius: 5px;
    background: var(--paper);
    cursor: pointer;
    position: relative;
}
.box:hover { border-color: var(--ink-3); background: var(--wash); }
.ln.k-line > .box { display: none; }

.ln[data-done="1"] > .box { background: var(--ink); border-color: var(--ink); }
.ln[data-done="1"] > .box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1.5px;
    width: 4px;
    height: 8px;
    border: solid var(--paper);
    border-width: 0 1.7px 1.7px 0;
    transform: rotate(43deg);
}

.ln .text {
    flex: 1;
    min-width: 0;
    color: var(--task);
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 1px 2px;
}
.ln .text:focus { box-shadow: none; }

.ln.is-done > .text { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }

/* Une ligne qui a un etat se voit de loin : un aplat tenu dans la couleur de
   l'etat, et un liseré a gauche. Declare apres « :hover », qui a le meme
   poids — sinon le survol effacerait la surbrillance. */
.ln[data-state] { background: color-mix(in srgb, var(--st) 8%, transparent); }

/* Le liseré est un trait droit, pas une ombre interne : arrondi par le rayon
   de la ligne, il se lirait comme une parenthese. */
.ln[data-state]::after {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 2px;
    border-radius: 2px;
    background: var(--st);
}
.ln[data-state]:hover { background: color-mix(in srgb, var(--st) 13%, transparent); }

/* Sauf l'abandon, qui ne merite pas qu'on le remarque : la ligne s'efface au
   lieu de s'allumer. Elle reste lisible — on doit pouvoir la relire pour la
   reprendre — mais elle cesse de reclamer l'attention. */
.ln.st-dropped { background: transparent; }
.ln.st-dropped:hover { background: var(--wash-2); }
.ln.st-dropped > .text { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }

/* Titres de section : sans case, mais avec du poids. Meme corps que le reste,
   pour que le pas vertical du document reste regulier. */
.ln.k-line > .text { font-weight: 650; color: var(--ink); }

/* Une ligne repliee annonce ce qu'elle cache. */
.ln.is-folded > .text::after {
    content: attr(data-kids);
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: var(--pill);
    background: var(--wash);
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 500;
    font-family: var(--sans);
    vertical-align: 1px;
}

/* Mise en forme posee a la ligne, par le crayon. */
.ln.f-b > .text { font-weight: 700; }
.ln.f-u > .text { text-decoration: underline; text-underline-offset: 3px; }
.ln.f-box > .text {
    background: var(--wash);
    border-radius: 7px;
    padding: 1px 9px;
    flex: 0 1 auto;
}
.ln.f-red > .text { color: #d0341c; }
.ln.f-blue > .text { color: #1b4de4; }
.ln.f-yellow > .text { color: #b57e00; }
.ln.f-green > .text { color: #00875a; }
.ln.f-orange > .text { color: #ef6602; }
.ln.f-violet > .text { color: #6b2fd6; }
.ln.f-ink > .text { color: #15171c; }
.ln.f-grey > .text { color: #8a8a8a; }

/* Ligne retrouvee par la recherche : elle se signale, puis s'efface. */
.ln.is-found { animation: found 2.4s ease-out; }
@keyframes found {
    0%, 55% { background: #fff3cd; }
    100% { background: transparent; }
}

.ln-tools {
    flex: 0 0 auto;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity .1s linear;
}
.ln:hover .ln-tools, .ln-tools:focus-within { opacity: 1; }
.ln-tools button {
    border: 0;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    width: 24px;
    height: 24px;
    border-radius: 7px;
}
.ln-tools button:hover { background: var(--wash); color: var(--ink); }

/* La note d'une ligne : un commentaire sous elle, pas un calque au-dessus
   du document. Elle passe a la ligne suivante du meme flex, se cale sous le
   texte de sa ligne — d'ou « --depth » — et pousse la suite vers le bas. */
.ln-note {
    position: relative;
    flex: 1 0 100%;
    margin: 2px 0 4px;
    /* Le decalage est en padding et non en marge : une marge s'ajouterait a
       la largeur de base et ferait deborder la note hors de la carte. */
    padding-left: calc(var(--depth, 0) * 26px + 66px);
    font-size: 12px;
    line-height: 1.5;
    color: var(--ink-3);
}
.ln-note::before {
    content: "";
    position: absolute;
    left: calc(var(--depth, 0) * 26px + 57px);
    top: 2px;
    bottom: 2px;
    width: 2px;
    border-radius: 2px;
    background: var(--rule);
}
.ln.k-line .ln-note { padding-left: calc(var(--depth, 0) * 26px + 41px); }
.ln.k-line .ln-note::before { left: calc(var(--depth, 0) * 26px + 32px); }

.ln.is-dragging { opacity: .35; }
.drop-marker { height: 0; border-top: 2px solid var(--accent); border-radius: 2px; margin: -1px 0; }

/* Mise en forme d'une portion : le stockage utilise ces classes, l'editeur
   les convertit en styles en ligne pour que le navigateur sache les defaire.
   L'encadre est devenu une pastille : elle prend la teinte du texte qu'elle
   entoure, gris quand il n'y en a pas. */
.ln .text .s-box {
    background: color-mix(in srgb, currentColor 9%, transparent);
    border-radius: 6px;
    padding: 1px 6px;
    font-family: var(--mono);
    font-size: .92em;
}
.ln .text .s-red { color: #d0341c; }
.ln .text .s-blue { color: #1b4de4; }
.ln .text .s-yellow { color: #b57e00; }
.ln .text .s-green { color: #00875a; }
.ln .text .s-orange { color: #ef6602; }
.ln .text .s-violet { color: #6b2fd6; }
.ln .text .s-ink { color: #15171c; }
.ln .text .s-grey { color: #8a8a8a; }

/* crayon flottant, en haut a gauche de la selection */
.sel-pen {
    position: absolute;
    z-index: 71;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--paper);
    box-shadow: var(--shadow-pop);
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}
.sel-pen:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* choix de la page cible : meme boite que la palette, mais en liste, donc
   il faut defaire la taille fixe de ses boutons — d'ou le selecteur long. */
.pages-pick { padding: 6px; }
.pick { display: flex; flex-direction: column; align-items: stretch; min-width: 200px; }
.pick-label {
    font-size: 9.5px;
    font-weight: 650;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 8px 8px 4px;
}
.pick-label:first-child { padding-top: 2px; }
.fmt .pick button {
    width: auto;
    height: auto;
    min-height: 28px;
    text-align: left;
    padding: 5px 8px;
    border-radius: 7px;
    font-size: 13px;
    font-family: var(--sans);
}

/* Le menu des etats. Meme boite que le choix de page, mais chaque entree
   porte sa pastille : on choisit sur la forme et la couleur qu'on verra
   ensuite dans la gouttiere, pas sur un mot. */
.state-pick { padding: 6px; }
.state-pick .pick { min-width: 244px; }

.fmt .pick button.st-none,
.state-pick .pick button {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.st-dot {
    flex: 0 0 auto;
    position: relative;
    align-self: center;
    width: 11px;
    height: 11px;
    border: 1.5px solid var(--st);
    border-radius: var(--pill);
}

/* Camembert a moitie plein : dans le menu, « en cours » n'a pas de
   pourcentage a montrer — juste sa nature de jauge. */
.st-dot.st-doing { background: conic-gradient(var(--st) 50%, transparent 0); }

.st-dot.st-waiting::before,
.st-dot.st-blocked::before,
.st-dot.st-review::before,
.st-dot.st-dropped::before,
.st-dot.st-dropped::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--st);
}
.st-dot.st-waiting::before {
    width: 4px;
    height: 5px;
    background: none;
    border-left: 1.5px solid var(--st);
    border-right: 1.5px solid var(--st);
}
.st-dot.st-blocked::before { width: 6px; height: 1.5px; border-radius: 1px; }
.st-dot.st-review::before { width: 4px; height: 4px; border-radius: var(--pill); }
.st-dot.st-dropped::before,
.st-dot.st-dropped::after { width: 7px; height: 1.5px; border-radius: 1px; }
.st-dot.st-dropped::before { transform: translate(-50%, -50%) rotate(45deg); }
.st-dot.st-dropped::after { transform: translate(-50%, -50%) rotate(-45deg); }

.st-name { flex: 0 0 auto; }

/* L'explication n'est la que pour le doute : elle s'efface devant le nom. */
.st-hint {
    flex: 1;
    min-width: 0;
    text-align: right;
    font-size: 11px;
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fmt .pick button.on .st-hint,
.fmt .pick button:hover .st-hint { color: inherit; opacity: .7; }

.pick-sep { height: 1px; background: var(--rule-2); margin: 5px 4px; }
.fmt .pick button.st-none { color: var(--ink-2); }

/* palette de mise en forme */
.fmt {
    position: absolute;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--r);
    box-shadow: var(--shadow-pop);
    padding: 5px 6px;
}
.fmt button {
    border: 0;
    background: transparent;
    cursor: pointer;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    font-size: 12px;
    color: var(--ink-2);
}
.fmt button:hover { background: var(--wash); }
.fmt button.on { background: var(--ink); color: #fff; }
.fmt .fb { font-weight: 700; }
.fmt .fu { text-decoration: underline; }
.fmt .fsep { width: 1px; height: 18px; background: var(--rule); margin: 0 4px; }
.fmt .fc:hover { background: #fdf3f1; color: var(--accent); }
.fmt .dot { width: 16px; height: 16px; border-radius: var(--pill); background: var(--key); border: 0; }
.fmt .dot.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--key); }

/* Filtres de lecture : ce qu'on masque ne quitte pas le document. */
.f-todo .ln.is-done { display: none; }
.f-done .ln.k-task:not(.is-done) { display: none; }

/* ---------- outils au survol ---------- */

.tools { display: flex; gap: 1px; flex: 0 0 auto; opacity: 0; transition: opacity .1s linear; }
.page-item:hover .tools, .prow:hover .row-tools, .tools:focus-within { opacity: 1; }
.tools button {
    border: 0;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    width: 24px;
    height: 24px;
    border-radius: 7px;
}
.tools button:hover { background: var(--wash); color: var(--ink); }
.tools button.x:hover { background: #fdf3f1; color: var(--accent); }

/* ---------- sommaire des pages (colonne de droite) ---------- */

.pages { display: flex; flex-direction: column; gap: 16px; }
.pages .stack { padding: 6px 0 4px; }
.pages .panel-head { border-bottom: 0; padding: 10px 16px 6px; }

.page-list { list-style: none; margin: 0; padding: 0 8px; }

.page-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px 7px 10px;
    border-radius: var(--r-sm);
}
.page-item:hover { background: var(--wash-2); }
.page-item.on { background: var(--wash); }

.page-item::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: var(--pill);
    background: #ccd0d8;
    flex: 0 0 auto;
}
.page-item.on::before { background: var(--key); }

.page-link { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-2); word-break: break-word; }
.page-item:hover .page-link { color: var(--ink); }
.page-item.on .page-link { font-weight: 600; color: var(--ink); }

.page-side { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.page-count {
    font-size: 11.5px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}
.minibar { width: 46px; height: 4px; border-radius: var(--pill); background: var(--rule-2); overflow: hidden; }
.minibar i { display: block; height: 100%; background: var(--key); border-radius: var(--pill); }

/* Les outils prennent la place des compteurs : la ligne ne s'allonge pas. */
.page-item:hover .page-side { display: none; }
.page-item .tools { display: none; }
.page-item:hover .tools { display: flex; }

.page-empty { font-size: 12.5px; color: var(--ink-3); padding: 4px 10px 8px; }

/* Un titre de reserve se signale : ce qu'on y ecrit n'engage a rien. */
.tag-reserve {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ink-3);
    background: var(--wash);
    border-radius: var(--pill);
    padding: 2px 8px;
}
/* La carte entiere prend une teinte creme : on voit d'un coup d'oeil qu'on
   n'est pas dans le travail engage. */
.is-reserve { background: #fffdf8; }
.is-reserve .panel-foot { background: #fffcf3; }

/* ---------- fiche du projet (colonne de droite) ---------- */

.facts { padding: 14px 16px; }
.facts dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.facts dt { font-size: 13px; color: var(--ink-3); }
.facts dd { margin: 0; font-size: 13px; font-weight: 500; text-align: right; }

/* ---------- carnet d'idees de projet ---------- */

.seed-note {
    margin: 0;
    padding: 4px 16px 14px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ink-3);
}
.seed-note a { color: var(--ink-2); font-weight: 500; }
.seed-note a:hover { color: var(--accent); }

/* ---------- edition en place ---------- */

.editable { outline: none; border-radius: 6px; }
.editable:hover { background: var(--wash-2); box-shadow: 0 0 0 4px var(--wash-2); }
.editable:focus { background: var(--wash); box-shadow: 0 0 0 4px var(--wash); }
.editable:empty::before { content: attr(data-placeholder); color: var(--ink-3); }

/* ---------- replis ---------- */

.archive { margin-top: 22px; }
.archive summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 550;
    color: var(--ink-3);
    padding: 6px 10px;
    border-radius: var(--r-sm);
}
.archive summary::marker, .archive summary::-webkit-details-marker { display: none; }
.archive summary::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform .12s ease;
}
.archive[open] summary::before { transform: rotate(90deg); }
.archive summary:hover { background: var(--wash); color: var(--ink); }
.archive .plist { margin-top: 8px; }
.archive .dim { opacity: .7; }

/* ---------- corbeille ---------- */

.trash-list { list-style: none; margin: 8px 0 0; padding: 0; }

.trash-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 20px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--rule-2);
}
.trash-item:last-child { border-bottom: 0; }
.trash-name { font-size: 14.5px; font-weight: 600; }
.trash-meta { grid-column: 1; font-size: 12px; color: var(--ink-3); }
.trash-actions {
    grid-row: 1 / 3;
    grid-column: 2;
    align-self: center;
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (max-width: 620px) {
    .trash-item { grid-template-columns: 1fr; }
    .trash-actions { grid-row: auto; grid-column: 1; margin-top: 10px; }
}

/* ---------- recherche ---------- */

.palette {
    border: 0;
    padding: 0;
    background: transparent;
    width: min(620px, calc(100% - 32px));
    max-width: none;
    margin-top: 12vh;
    color: var(--ink);
}
.palette::backdrop { background: rgba(20, 23, 28, .28); backdrop-filter: blur(2px); }

.palette-box {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pop);
    overflow: hidden;
}
.palette-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: 54px;
    border-bottom: 1px solid var(--rule-2);
    color: var(--ink-3);
}
.palette-head input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 15px;
    color: var(--ink);
}
.palette-head input::placeholder { color: var(--ink-3); }

.palette-list { max-height: min(56vh, 460px); overflow: auto; padding: 6px; }
.palette-list:empty { display: none; }

.res-label {
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 10px 10px 4px;
}
.res {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.res:hover, .res.on { background: var(--wash); }
.res-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--pill);
    background: var(--key);
    flex: 0 0 auto;
}
.res-text { flex: 1; min-width: 0; }
.res-title {
    display: block;
    font-size: 13.5px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.res.is-done .res-title { color: var(--ink-3); text-decoration: line-through; }
.res-meta {
    display: block;
    font-size: 11.5px;
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.res mark { background: #fff3cd; color: inherit; border-radius: 3px; padding: 0 1px; }
.palette-empty { padding: 26px 14px; text-align: center; font-size: 13px; color: var(--ink-3); }
.palette-foot {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 9px 14px;
    border-top: 1px solid var(--rule-2);
    background: var(--wash-2);
    font-size: 11.5px;
    color: var(--ink-3);
}

/* ---------- boite de confirmation ---------- */

.ask {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: 440px;
    width: calc(100% - 40px);
    color: var(--ink);
}
.ask::backdrop { background: rgba(20, 23, 28, .28); backdrop-filter: blur(2px); }

.ask-box {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pop);
    padding: 22px 24px 18px;
}

.ask-kicker {
    margin: 0 0 8px;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.ask.is-danger .ask-kicker { color: var(--accent); }

.ask h2 { font-size: 18px; line-height: 1.35; letter-spacing: -0.015em; }

.ask-detail {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--ink-2);
    background: var(--wash-2);
    border: 1px solid var(--rule-2);
    border-radius: var(--r-sm);
    padding: 9px 12px;
}
.ask-note { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); }

.ask-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}
.ask.is-danger .btn.solid { background: var(--accent); border-color: var(--accent); }
.ask.is-danger .btn.solid:hover { background: #cf2c15; border-color: #cf2c15; }

/* ---------- toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    background: var(--ink);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--pill);
    box-shadow: var(--shadow-pop);
    font-size: 13px;
    font-weight: 500;
    transform: translate(-50%, 140%);
    transition: transform .18s cubic-bezier(.2, .8, .3, 1);
    z-index: 60;
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- petits ecrans ---------- */

@media (max-width: 900px) {
    .topbar-in { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; }
    .brand span:not(.mark) { display: none; }
}

@media (max-width: 720px) {
    :root { --gutter: 16px; }
    .page-head { grid-template-columns: 1fr; padding-top: 24px; }
    .page-head h1 { font-size: 24px; }

    /* Deux rangees : identite en haut, avancement dessous, colonnes alignees. */
    .prow { grid-template-columns: 36px minmax(0, 1fr) 56px 30px; row-gap: 12px; }
    .prow > .avatar { grid-area: 1 / 1; }
    .prow > .prow-open + .avatar + * { grid-area: 1 / 2; }
    .prow > .big { grid-area: 1 / 3; }
    .prow > .row-tools { grid-area: 1 / 4; }
    .prow > .track-cell { grid-area: 2 / 1 / 2 / 5; }

    .phead-grid { grid-template-columns: 1fr; }
    .phead h1 { font-size: 26px; }
    .pstat { padding-top: 0; }
    .pstat-top { justify-content: flex-start; gap: 20px; }
    .pstat .tracknote { text-align: left; }

    .panel-head { gap: 10px; }
    .panel-ctl { width: 100%; justify-content: space-between; }
    .editor-state { display: none; }

    .editor { padding-left: 46px; }
    .editor::before { width: 36px; }
    .ln::before { left: -22px; width: 16px; }
    .now { left: -37px; }

    /* Sans survol, les outils de ligne resteraient hors d'atteinte. */
    .tools, .ln-tools, .grip { opacity: 1; }
    .page-item .tools { display: flex; }
    .page-item:hover .page-side { display: flex; }
    .g { width: 22px; }
}

/* ------------------------------------------------------------------
   La porte : connexion et inscription. Une carte seule au milieu d'un
   fond neutre — rien a comparer, rien a choisir, une seule chose a
   faire. C'est le seul ecran de l'app qui ne montre aucune donnee.
   ------------------------------------------------------------------ */
.gate-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--canvas);
}

.gate {
    width: 100%;
    max-width: 372px;
    padding: 32px;
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.gate-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-bottom: 18px;
    border-radius: var(--r-sm);
    background: var(--accent);
    color: #fff;
}

.gate h1 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.gate-sub { margin: 6px 0 22px; color: var(--ink-2); font-size: 13px; line-height: 1.5; }

/* L'erreur se lit avant le formulaire, pas apres : on ne renvoie pas
   quelqu'un chercher pourquoi ca a echoue. */
.gate-error {
    margin-bottom: 16px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    background: #fdf3f1;
    color: #a3251a;
    font-size: 12.5px;
}

.gate-form { display: flex; flex-direction: column; gap: 14px; }
.gate-form label { display: flex; flex-direction: column; gap: 6px; }
.gate-form label > span { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.gate-form small { color: var(--ink-3); font-size: 11.5px; }

.gate-form input[type="email"],
.gate-form input[type="text"],
.gate-form input[type="password"] {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--paper);
    font-family: var(--sans);
    font-size: 14px;
    color: var(--ink);
}
.gate-form input:focus {
    outline: none;
    border-color: var(--ink-3);
    box-shadow: 0 0 0 3px var(--wash);
}

.gate-check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.gate-check > span { font-weight: 400 !important; color: var(--ink-2); font-size: 12.5px; }

.gate-form button {
    margin-top: 4px;
    padding: 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: var(--ink);
    color: #fff;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
}
.gate-form button:hover { background: #000; }

.gate-alt { margin: 20px 0 0; text-align: center; font-size: 12.5px; color: var(--ink-3); }
.gate-alt a { color: var(--ink); font-weight: 550; }

/* ------------------------------------------------------------------
   Le compte, dans la barre du haut. Une initiale : il n'y a qu'une
   action derriere, elle n'a pas besoin d'occuper de la place.
   ------------------------------------------------------------------ */
.me { position: relative; margin-left: 10px; flex: 0 0 auto; }
.me > summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    border-radius: var(--pill);
    background: var(--wash);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.me > summary::-webkit-details-marker { display: none; }
.me > summary:hover { background: var(--rule-2); color: var(--ink); }

.me-pop {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 80;
    display: flex;
    flex-direction: column;
    min-width: 208px;
    padding: 12px;
    border: 1px solid var(--rule);
    border-radius: var(--r);
    background: var(--paper);
    box-shadow: var(--shadow-pop);
}
.me-name { font-size: 13px; font-weight: 600; }
.me-mail { margin-bottom: 10px; color: var(--ink-3); font-size: 11.5px; word-break: break-all; }
.me-pop button {
    width: 100%;
    padding: 7px;
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--paper);
    font-family: var(--sans);
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
}
.me-pop button:hover { background: var(--wash); color: var(--ink); }

/* ------------------------------------------------------------------
   Brancher un agent : la commande a copier. Elle est longue et ne se
   retient pas — elle doit donc etre selectionnable d'un geste, et
   lisible sans deformer la page.
   ------------------------------------------------------------------ */
.token-card { margin-top: 22px; padding: 22px; }
.token-card h2 { margin: 0 0 4px; font-size: 14px; }
.token-say { margin: 0 0 14px; color: var(--ink-2); font-size: 12.5px; line-height: 1.55; max-width: 62ch; }

.token-flash {
    margin: 0 0 12px;
    padding: 8px 11px;
    border-radius: var(--r-sm);
    background: var(--ok-bg);
    color: var(--ok-ink);
    font-size: 12.5px;
}

/* Le bloc defile sur lui-meme : une commande de 150 caracteres ne doit
   pas pousser la page a scroller horizontalement. */
.token-cmd {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--rule-2);
    border-radius: var(--r-sm);
    background: var(--wash-2);
    overflow-x: auto;
}
.token-cmd code {
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--ink);
    white-space: pre;
    user-select: all;
}

.token-form { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.token-form button {
    padding: 6px 12px;
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--paper);
    font-family: var(--sans);
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
}
.token-form button:hover { background: var(--wash); color: var(--ink); }
.token-form span { color: var(--ink-3); font-size: 11.5px; }

/* Le lien vers son compte, dans le menu de la barre du haut. */
.me-link {
    display: block;
    margin-bottom: 8px;
    padding: 7px 8px;
    border-radius: var(--r-sm);
    color: var(--ink-2);
    font-size: 12.5px;
    text-decoration: none;
}
.me-link:hover { background: var(--wash); color: var(--ink); }

/* ------------------------------------------------------------------
   Mon compte. Colonne etroite : ce sont des reglages, pas un tableau —
   on les lit un par un, et une pleine largeur donnerait des champs de
   formulaire longs comme des lignes de texte.
   ------------------------------------------------------------------ */
.acct { max-width: 560px; margin: 0 auto; }
.acct-h { margin: 0 0 18px; font-size: 20px; letter-spacing: -0.01em; }

.acct-flash {
    margin: 0 0 16px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    background: var(--ok-bg);
    color: var(--ok-ink);
    font-size: 12.5px;
}

.acct-card { margin-bottom: 16px; padding: 22px; }
.acct-card h2 { margin: 0 0 4px; font-size: 14px; }
.acct-say { margin: 0 0 16px; color: var(--ink-2); font-size: 12.5px; line-height: 1.55; }

.acct-form { display: flex; flex-direction: column; gap: 14px; }
.acct-form label { display: flex; flex-direction: column; gap: 6px; }
.acct-form label > span { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.acct-form small { color: var(--ink-3); font-size: 11.5px; }

/* L'erreur se pose sous le champ fautif : un bandeau en tete du
   formulaire obligerait a chercher lequel des quatre est en cause. */
.acct-form em {
    font-style: normal;
    font-size: 11.5px;
    color: var(--accent);
}

.acct-form input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--paper);
    font-family: var(--sans);
    font-size: 14px;
    color: var(--ink);
}
.acct-form input:focus {
    outline: none;
    border-color: var(--ink-3);
    box-shadow: 0 0 0 3px var(--wash);
}

.acct-form button {
    align-self: flex-start;
    margin-top: 2px;
    padding: 8px 16px;
    border: 0;
    border-radius: var(--r-sm);
    background: var(--ink);
    color: #fff;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
}
.acct-form button:hover { background: #000; }

/* La mise en garde sous la commande : presente, mais elle ne doit pas peser
   autant que l'explication qui la precede. */
.snip-note.dim { color: var(--ink-3); font-size: 11.5px; }
.snip-note.dim a { color: var(--ink-2); }

/* La precision sous la commande : utile, mais elle ne doit pas peser autant
   que la phrase qui explique a quoi la commande sert. */
.token-say.dim { margin: 12px 0 0; color: var(--ink-3); font-size: 11.5px; }

/* Un chemin ou un nom de fichier cite au fil du texte. */
.snip-head code, .snip-note code {
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--wash);
    font-family: var(--mono);
    font-size: .92em;
}
