/* KaziBox Priority — feuille de styles
   Concept : un cahier d'écolier. Papier blanc #FFF à carreaux Seyès très pâles,
   marge rose discrète, encre bleu marine, étiquette collée sur la couverture.
   L'application reste sobre : les seules couleurs vives sont celles des surligneurs. */
:root {
  --navy: #1B2A4E;          /* encre principale */
  --navy-2: #2E4372;        /* survol */
  --ink: #1B2A4E;
  --muted: #5C6A85;
  --paper: #FFFFFF;
  --wash: #F3F5FA;          /* fond très léger des boutons secondaires */
  --line-minor: #E8EDF6;    /* lignes fines Seyès */
  --line-major: #CCD6E8;    /* lignes principales Seyès */
  --margin: #E7A9AE;        /* marge rose du cahier */
  --danger: #9E3530;
  --ok: #1B2A4E;

  --f-hand: 'Kalam', 'Noto Sans', 'Comic Sans MS', 'Segoe Print', cursive;
  --f-body: 'Atkinson Hyperlegible', 'Noto Sans', 'Segoe UI', Roboto, system-ui, sans-serif;

  --u: 32px;                /* un grand carreau */
  --tap: 52px;
  --radius: 10px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));

  /* Papier Seyès : 4 lignes fines par carreau, ligne forte et verticale tous les 32 px */
  --seyes:
    linear-gradient(to right, transparent calc(var(--u) - 1px), var(--line-major) calc(var(--u) - 1px)) 0 0 / var(--u) var(--u),
    linear-gradient(to bottom, transparent calc(var(--u) - 1px), var(--line-major) calc(var(--u) - 1px)) 0 0 / 100% var(--u),
    linear-gradient(to bottom, transparent calc(var(--u) / 4 - 1px), var(--line-minor) calc(var(--u) / 4 - 1px)) 0 0 / 100% calc(var(--u) / 4);

  /* Surligneurs translucides (feutres fluo) */
  --hl-yellow: rgba(255, 234, 0, .55);
  --hl-blue: rgba(0, 174, 255, .32);
  --hl-green: rgba(0, 214, 96, .36);
  --hl-orange: rgba(255, 145, 0, .42);
  --hl-gray: rgba(130, 130, 145, .30);
  --hl-pink: rgba(255, 64, 172, .32);
  --hl-violet: rgba(150, 84, 255, .30);
  --hl-red: rgba(235, 20, 20, .45);
  --hl-mauve: rgba(170, 90, 150, .40);
  --hl-lime: rgba(174, 240, 0, .48);

  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.125rem;
  line-height: 1.5;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy); }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { display: inline-flex; width: 24px; height: 24px; flex: none; }
.ico svg { width: 100%; height: 100%; }
.center { text-align: center; display: block; margin-inline: auto; }
.muted { color: var(--muted); }
.pad { padding-block: 32px; }

#view { max-width: 680px; margin: 0 auto; padding-bottom: 128px; perspective: 1600px; }
.pagewrap { transform-origin: left center; backface-visibility: hidden; }

/* ---------- Page qu'on tourne ---------- */
.pagewrap.turn-fwd { animation: turnFwd .5s cubic-bezier(.2, .7, .2, 1) both; transform-origin: left center; }
.pagewrap.turn-back { animation: turnBack .45s cubic-bezier(.2, .7, .2, 1) both; transform-origin: right center; }
@keyframes turnFwd {
  0% { transform: rotateY(-38deg) translateX(24px); opacity: 0; filter: brightness(.94); }
  60% { opacity: 1; }
  100% { transform: none; opacity: 1; filter: none; }
}
@keyframes turnBack {
  0% { transform: rotateY(30deg) translateX(-24px); opacity: 0; filter: brightness(.94); }
  60% { opacity: 1; }
  100% { transform: none; opacity: 1; filter: none; }
}

/* ---------- Couverture : étiquette d'écolier ---------- */
.top { padding-top: 12px; }
.top-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 40px; }
.lang-wrap { flex: none; }
.lang {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--line-major); background: var(--paper);
  border-radius: 999px; padding: 4px 12px; font-size: .8rem; color: var(--muted); min-height: 36px; max-width: 9em;
}
.gear { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #A3AEC2; }
.gear .ico { width: 20px; height: 20px; }
.gear:hover, .gear:focus-visible { color: var(--navy); background: var(--wash); }
.saveind { display: flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); min-height: 24px; margin-right: auto; }
.saveind .save-ico { width: 18px; height: 18px; color: var(--navy); }
.save-err { border: 1.5px solid var(--danger); background: var(--paper); color: var(--danger); font-weight: 700; border-radius: 999px; padding: 5px 12px; font-size: .8rem; }

.etiquette {
  position: relative; margin: 14px auto 6px; max-width: 340px; background: var(--paper);
  border: 2px solid var(--navy); border-radius: 22px; padding: 6px;
  transform: rotate(-1.2deg);
  box-shadow: 0 1px 0 rgba(27, 42, 78, .08), 0 6px 14px -8px rgba(27, 42, 78, .35);
}
.etq-in {
  border: 1px solid var(--navy); border-radius: 16px; padding: 12px 18px 14px;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 14px; align-items: center;
}
.etq-logo { width: 40px; height: 40px; grid-row: span 2; }
.etq-logo svg { width: 100%; height: 100%; display: block; }
.etq-cap { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.brand {
  margin: 0; font-family: var(--f-hand); font-weight: 700; font-size: 1.75rem; line-height: 1.15; color: var(--navy);
  border-bottom: 1.5px dotted var(--navy); padding-bottom: 2px; outline: none; overflow-wrap: anywhere;
}
.brand-sub { font-weight: 400; }

.help-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 14px; margin: 10px 0 6px; font-size: .8rem; transition: opacity .2s, transform .2s; }
.help-row.bye { opacity: 0; transform: translateY(-6px); }
.help-row .speaker { min-height: 32px; padding: 2px 10px 2px 6px; font-size: .8rem; border-width: 1px; color: var(--muted); border-color: var(--line-major); }
.help-row .speaker .ico { width: 16px; height: 16px; }
.help-row .aud-btn { min-height: 32px; font-size: .8rem; padding: 2px 10px 2px 6px; }
.help-row .aud-btn .ico { width: 16px; height: 16px; }
.help-x { border: 0; background: none; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; font-size: 1.2rem; line-height: 1; display: grid; place-items: center; }
.help-x:hover { background: var(--wash); color: var(--navy); }
.help-link { font-size: .8rem; color: var(--muted); color: var(--navy); text-decoration: underline; text-decoration-color: var(--line-major); text-decoration-thickness: 1px; text-underline-offset: 4px; padding-block: 6px; }
.help-link:hover { text-decoration-color: var(--navy); }
.speaker {
  display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--navy); background: var(--paper); color: var(--navy);
  border-radius: 999px; padding: 5px 14px 5px 10px; min-height: 40px; font-size: .95rem;
}
.speaker .ico { width: 22px; height: 22px; }
.audio { display: inline-flex; gap: 8px; align-items: center; }
.aud-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; border: 1.5px solid var(--navy); background: var(--navy); color: #fff; border-radius: 999px; padding: 4px 14px 4px 10px; font-size: .9rem; }
.aud-btn + .aud-btn { background: var(--paper); color: var(--navy); }
.aud-btn .ico { width: 20px; height: 20px; }
.introtext, .demo-note {
  border: 1.5px dashed var(--line-major); border-radius: var(--radius); padding: 10px 14px; margin: 6px 0 10px; font-size: .95rem; background: var(--paper);
}
.introtext p, .demo-note p { margin: 0 0 4px; }

/* ---------- La page du cahier (liste) ---------- */
.notebook {
  position: relative; background: var(--paper); background-image: none;
  border-top: 1.5px solid var(--line-major);
  margin-inline: calc(-1 * var(--gutter-l)) calc(-1 * var(--gutter-r));
  padding-inline: var(--gutter-l) var(--gutter-r);
}
.notebook::before { /* papier Seyès en fond */
  content: ""; position: absolute; inset: 0; background: var(--seyes); opacity: .9; pointer-events: none;
}
.notebook > * { position: relative; }
.plist { list-style: none; margin: 0; padding: 0; position: relative; }
.prow {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 48px 48px; align-items: start;
  min-height: calc(var(--u) * 2); position: relative; transition: transform .18s ease;
}
.prow::before { /* marge rose */
  content: ""; position: absolute; left: 56px; top: 0; bottom: 0; width: 1.5px; background: var(--margin);
}
.pnum {
  font-family: var(--f-hand); font-weight: 700; font-size: 1.55rem; color: var(--navy);
  text-align: right; line-height: max(var(--u), 1.2em); font-variant-numeric: tabular-nums;
  border: 0; background: none; cursor: pointer; border-radius: 8px; width: 100%;
  padding: calc(var(--u) / 2 - 3px) 12px calc(var(--u) / 2 - 3px) 0; min-height: 48px;
}
button.pnum:hover { background: var(--wash); text-decoration: underline; text-underline-offset: 4px; }
.pnum::after { content: "."; }
.ptitle {
  border: 0; background: none; text-align: left; display: block; width: 100%;
  padding: calc(var(--u) / 2) 6px calc(var(--u) / 2) 14px; font-size: 1.12rem; line-height: max(var(--u), 1.45em); color: var(--ink);
}
.ptext { overflow-wrap: anywhere; }
.prow.hl .ptext, .hlt {
  background: linear-gradient(100deg, transparent 0 1%, var(--hl) 2% 97%, transparent 99%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  padding: 2px 5px; margin: 0 -5px; border-radius: 3px 7px 4px 8px;
}
.tag {
  display: inline-block; vertical-align: middle; margin-left: 8px; font-size: .74rem; line-height: 20px;
  color: var(--muted); border: 1px solid var(--line-major); background: var(--paper); border-radius: 4px; padding: 0 7px;
}
.tag-ex { font-style: italic; }
.pclip { display: inline-flex; vertical-align: middle; align-items: center; gap: 2px; margin-left: 8px; font-size: .8rem; color: var(--muted); line-height: 20px; }
.pclip .ico { width: 16px; height: 16px; }
.phandle, .pmore {
  border: 0; background: none; color: #8B97AE; width: 48px; height: 48px; margin-top: max(0px, calc(var(--u) / 2 - 8px)); display: grid; place-items: center; border-radius: 8px;
}
.phandle { touch-action: none; cursor: grab; }
.phandle .ico, .pmore .ico { width: 24px; height: 24px; }
.phandle:hover, .pmore:hover { background: var(--wash); color: var(--navy); }
.plist.is-dragging { user-select: none; -webkit-user-select: none; }
.plist.is-dragging .prow:not(.dragging) { transition: transform .18s ease; }
.prow.dragging {
  z-index: 5; transition: none; background: var(--paper); border-radius: 6px;
  box-shadow: 0 10px 24px -6px rgba(27, 42, 78, .35); transform-origin: center;
}
.prow.dragging .phandle { cursor: grabbing; color: #fff; background: var(--navy); }
.prow.flash .ptitle { animation: flash 1.6s ease; }
@keyframes flash { 0%, 35% { background: rgba(27, 42, 78, .07); } 100% { background: transparent; } }

.empty { text-align: center; padding: 56px 8px 40px; }
.empty-num { font-family: var(--f-hand); font-size: 3.4rem; font-weight: 700; color: var(--line-major); line-height: 1; }
.empty-title { font-family: var(--f-hand); color: var(--navy); font-size: 1.7rem; font-weight: 700; margin: 6px 0 2px; }
.empty-text { color: var(--muted); max-width: 24em; margin: 0 auto; background: var(--paper); }

.list-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 22px; padding: 20px 0 6px; font-size: .92rem; }
.list-foot a { color: var(--muted); padding: 8px 2px; }

/* ---------- Bouton principal fixe ---------- */
.addbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, var(--paper) 72%, rgba(255, 255, 255, 0));
}
.addbar .btn-add { max-width: 680px; margin: 0 auto; width: 100%; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--tap);
  border-radius: var(--radius); padding: 10px 20px; font-size: 1.05rem; border: 1.5px solid transparent; text-decoration: none; font-weight: 700;
}
.btn:disabled { opacity: .55; }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 6px 14px; font-size: .95rem; }
.btn-add {
  background: var(--navy); color: #fff; font-size: 1.18rem; min-height: 60px;
  box-shadow: 0 2px 0 #0E1830;
}
.btn-add:hover { background: var(--navy-2); }
.btn-add:active { transform: translateY(1px); box-shadow: 0 1px 0 #0E1830; }
.btn-add .ico { width: 26px; height: 26px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-outline { background: var(--paper); color: var(--navy); border-color: var(--navy); }
.btn-ghost { background: var(--wash); color: var(--navy); }
.btn-danger { background: var(--danger); color: #fff; }
.danger { color: var(--danger) !important; }
.link-btn { border: 0; background: none; color: var(--navy); text-decoration: underline; text-underline-offset: 4px; padding: 12px; font-size: 1rem; }
.link-btn.danger { margin-top: 20px; font-size: .95rem; }

/* ---------- Pages intérieures ---------- */
.page { padding-top: 12px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.backbtn {
  display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--navy); background: var(--paper); color: var(--navy);
  font-size: 1.02rem; min-height: var(--tap); padding: 6px 18px 6px 10px; border-radius: 999px; font-weight: 700;
}
.topbar .saveind { margin-right: 0; }
.page-title {
  width: 100%; font-family: var(--f-hand); font-weight: 700; color: var(--navy); font-size: 1.9rem; line-height: 1.2;
  margin: 18px 0 14px; outline: none; text-wrap: balance;
  text-decoration: underline double; text-decoration-color: var(--navy); text-decoration-thickness: 1.5px; text-underline-offset: 8px;
}
.lead { font-size: 1.05rem; margin: 4px 0 14px; }
.warn { border-left: 3px solid var(--margin); padding: 6px 14px; font-size: .95rem; color: var(--ink); }

.field-label { display: block; font-weight: 700; margin: 10px 0 6px; }
.field-label.big { font-family: var(--f-hand); font-size: 1.5rem; color: var(--navy); }
.field-help { color: var(--danger); font-size: .95rem; min-height: 1.2em; margin: 6px 0; }
.input {
  width: 100%; min-height: var(--tap); border: 1.5px solid var(--line-major); border-radius: 8px; padding: 10px 14px; background: var(--paper); font-size: 1.05rem;
}
.input:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(27, 42, 78, .1); }
.input-big {
  font-size: 1.3rem; min-height: 64px; border: 0; border-bottom: 2px solid var(--navy); border-radius: 0; padding: 10px 4px;
  font-family: var(--f-hand); background: transparent;
}
.input-big:focus { box-shadow: none; border-bottom-width: 3px; }
.input-num { max-width: 7em; text-align: center; font-size: 1.3rem; font-weight: 700; }
.input-code { letter-spacing: .3em; font-size: 1.3rem; text-align: center; }
.inline-field { display: flex; gap: 10px; align-items: stretch; }
.inline-field .input { flex: 1; min-width: 0; }
.addform { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.addform .btn-add { margin-top: 14px; }
.stack { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

/* ---------- Dossier : une page du cahier ---------- */
.detail { position: relative; }
.banner { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; margin: 14px 0 0; border: 1.5px solid var(--line-major); color: var(--navy); font-weight: 700; }
.detail-head { display: flex; align-items: flex-start; gap: 6px; margin: 18px 0 4px; }
.detail-num { font-family: var(--f-hand); font-weight: 700; color: var(--navy); font-size: 2rem; line-height: 1.3; }
.title-input {
  flex: 1; min-width: 0; border: 0; resize: none; overflow: hidden; background: transparent; padding: 2px 4px;
  font-family: var(--f-hand); font-weight: 700; font-size: 1.75rem; line-height: 1.35; color: var(--navy); border-radius: 6px;
  text-decoration: underline double; text-decoration-thickness: 1.5px; text-underline-offset: 8px;
}
.detail-head.hl .title-input { background: linear-gradient(100deg, transparent 0 1%, var(--hl) 2% 97%, transparent 99%); }
.title-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(27, 42, 78, .1); }
.block { margin-top: 28px; }
.block-title {
  font-family: var(--f-hand); font-weight: 700; font-size: 1.35rem; color: var(--navy); margin: 0 0 4px;
  display: inline-block; border-bottom: 1.5px solid var(--navy); line-height: 1.2;
}
.block-hint { font-size: .88rem; color: var(--muted); margin: 6px 0 8px; }
.editor {
  position: relative; min-height: calc(var(--u) * 5); border: 1.5px solid var(--line-major); border-radius: 8px;
  padding: calc(var(--u) * .22) 14px calc(var(--u) * .78) 16px; line-height: max(var(--u), 1.5em); font-size: 1.08rem;
  background: var(--seyes); background-color: var(--paper); background-attachment: local;
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.editor:focus { outline: none; border-color: var(--navy); }
.editor.is-empty::before { content: attr(data-ph); color: #9AA5BB; pointer-events: none; position: absolute; }
.editor mark { color: inherit; padding: 1px 1px; border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
mark[data-c="yellow"] { background: var(--hl-yellow); }
mark[data-c="blue"] { background: var(--hl-blue); }
mark[data-c="green"] { background: var(--hl-green); }
mark[data-c="orange"] { background: var(--hl-orange); }
mark[data-c="gray"] { background: var(--hl-gray); }
mark[data-c="pink"] { background: var(--hl-pink); }
mark[data-c="violet"] { background: var(--hl-violet); }
mark[data-c="red"] { background: var(--hl-red); }
mark[data-c="mauve"] { background: var(--hl-mauve); }
mark[data-c="lime"] { background: var(--hl-lime); }
.editor u { text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--navy); }

.items { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.item { display: flex; align-items: flex-start; gap: 12px; padding: 10px; border: 1.5px solid var(--line-major); border-radius: 8px; background: var(--paper); }
.item-ico { width: 52px; height: 52px; flex: none; border-radius: 6px; border: 1px solid var(--line-major); color: var(--navy); display: grid; place-items: center; overflow: hidden; }
.item-ico.thumb { padding: 3px; background: #fff; box-shadow: 0 1px 3px rgba(27, 42, 78, .2); transform: rotate(-2deg); }
.item-ico.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-name, .item-link { font-weight: 700; overflow-wrap: anywhere; }
.item-meta { font-size: .82rem; color: var(--muted); }
.item-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.btn-mini { font-size: .88rem; color: var(--navy); border: 1.5px solid var(--navy); border-radius: 999px; padding: 4px 12px; text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }
.btn-mini[aria-disabled] { opacity: .45; }
.item-x { border: 0; background: none; color: var(--muted); width: 44px; height: 44px; border-radius: 8px; font-size: 1.1rem; flex: none; }
.item-x:hover { background: var(--wash); color: var(--danger); }
.audio-el { width: 100%; max-width: 100%; margin-top: 6px; height: 40px; }
#recbtn.rec { border-color: var(--danger); color: var(--danger); }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.hist summary { font-family: var(--f-hand); font-weight: 700; font-size: 1.2rem; color: var(--navy); cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.history { list-style: none; padding: 0; margin: 6px 0 0; font-size: .9rem; }
.history li { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 6px 0; border-bottom: 1px solid var(--line-minor); }
.history time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 11em; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 32px; }
.detail-actions .btn:only-child { grid-column: 1 / -1; }

/* ---------- Palette des feutres ---------- */
#palette {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--paper);
  border-top: 1.5px solid var(--line-major); box-shadow: 0 -6px 18px rgba(27, 42, 78, .1);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px max(12px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
}
#palette[hidden] { display: none !important; }
.pal-row { display: grid; grid-template-columns: repeat(5, 38px); gap: 6px; flex: none; padding: 2px; }
.pal-sw { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid rgba(27, 42, 78, .18); background: #fff; position: relative; overflow: hidden; }
.pal-sw::after { content: ""; position: absolute; inset: 0; background: var(--sw); }
.pal-sw[data-c="yellow"] { --sw: var(--hl-yellow); } .pal-sw[data-c="blue"] { --sw: var(--hl-blue); }
.pal-sw[data-c="green"] { --sw: var(--hl-green); } .pal-sw[data-c="orange"] { --sw: var(--hl-orange); }
.pal-sw[data-c="gray"] { --sw: var(--hl-gray); } .pal-sw[data-c="pink"] { --sw: var(--hl-pink); }
.pal-sw[data-c="violet"] { --sw: var(--hl-violet); } .pal-sw[data-c="mauve"] { --sw: var(--hl-mauve); }
.pal-sw[data-c="red"] { --sw: var(--hl-red); } .pal-sw[data-c="lime"] { --sw: var(--hl-lime); }
.pal-tool { flex: none; min-height: 82px; min-width: 44px; border: 1.5px solid var(--navy); background: var(--paper); color: var(--navy); border-radius: 8px; padding: 0 10px; font-size: .9rem; }
.pal-u span { text-decoration: underline; text-decoration-thickness: 2px; font-size: 1.15rem; font-weight: 700; }

/* ---------- Feuilles (bottom sheet) ---------- */
#sheet-root { position: fixed; inset: 0; z-index: 50; }
.backdrop { position: absolute; inset: 0; background: rgba(27, 42, 78, .35); opacity: 0; transition: opacity .2s; }
.backdrop.in { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--paper); border-radius: 18px 18px 0 0; outline: none; border-top: 1.5px solid var(--line-major);
  padding: 10px max(18px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet.in { transform: none; }
.sheet.center { bottom: auto; top: 50%; left: 16px; right: 16px; border-radius: 16px; border: 2px solid var(--navy); transform: translateY(-40%) rotate(-.6deg); opacity: 0; transition: transform .2s, opacity .2s; padding-top: 18px; }
.sheet.center.in { transform: translateY(-50%) rotate(-.6deg); opacity: 1; }
.sheet-grip { width: 44px; height: 4px; border-radius: 2px; background: var(--line-major); margin: 2px auto 12px; }
.sheet-title { font-family: var(--f-hand); font-weight: 700; color: var(--navy); font-size: 1.45rem; line-height: 1.25; margin: 0 0 12px; overflow-wrap: anywhere; }
.sheet-num { color: var(--navy); }
.sheet-text { color: var(--muted); margin: 0 0 16px; }
.sheet-label { font-weight: 700; font-size: .95rem; margin: 6px 0 8px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-bottom: 14px; }
.swatch { border: 1.5px solid transparent; background: none; border-radius: 10px; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 76px; }
.swatch.sel { border-color: var(--navy); }
.sw-dot { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(var(--sw), var(--sw)), #fff; border: 1.5px solid rgba(27, 42, 78, .18); display: grid; place-items: center; color: var(--navy); }
.swatch.none .sw-dot { background: repeating-linear-gradient(45deg, #fff 0 5px, var(--line-minor) 5px 10px); }
.sw-dot .ico { width: 22px; height: 22px; }
.sw-name { font-size: .74rem; line-height: 1.15; text-align: center; overflow-wrap: anywhere; color: var(--ink); }
.menu { display: flex; flex-direction: column; border-top: 1px solid var(--line-major); margin-bottom: 12px; }
.menu-item { display: flex; align-items: center; gap: 14px; min-height: 56px; border: 0; border-bottom: 1px solid var(--line-major); background: none; text-align: left; font-size: 1.08rem; padding: 6px 4px; color: var(--ink); }
.menu-item .ico { color: var(--navy); justify-content: center; align-items: center; font-size: 1.15rem; }
.menu-item.danger .ico { color: var(--danger); }
.menu-item:hover { background: var(--wash); }
.moveform { padding: 10px 0 14px; border-bottom: 1px solid var(--line-major); }

/* ---------- Intercalaires (archives), couleurs, aide ---------- */
.tabs { display: flex; gap: 6px; margin: 6px 0 0; padding-left: 8px; border-bottom: 1.5px solid var(--navy); }
.tab {
  border: 1.5px solid var(--line-major); border-bottom: 0; background: var(--wash); min-height: 46px; border-radius: 10px 10px 0 0;
  font-size: .98rem; color: var(--muted); padding: 6px 14px; margin-bottom: -1.5px;
}
.tab.on { background: var(--paper); color: var(--navy); border-color: var(--navy); font-weight: 700; position: relative; }
.tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; background: var(--paper); }
.arch-list { display: flex; flex-direction: column; }
.arch-item { padding: 12px 0; border-bottom: 1px solid var(--line-major); }
.arch-title { border: 0; background: none; text-align: left; padding: 4px 0; display: flex; flex-direction: column; gap: 2px; width: 100%; font-size: 1.08rem; color: var(--ink); }
.arch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.color-list { display: flex; flex-direction: column; gap: 10px; }
.color-row { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr); gap: 10px; align-items: center; }
.color-sample { font-size: 1rem; padding: 4px 6px; overflow-wrap: anywhere; }
@media (max-width: 420px) { .color-row { grid-template-columns: 1fr; gap: 2px; } .color-row + .color-row { margin-top: 6px; } }

.help .audio { margin: 6px 0 20px; }
.btn-listen .ico { width: 24px; height: 24px; }
.steps { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 16px; }
.steps li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 1.08rem; }
.step-n {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--navy); color: var(--navy);
  font-family: var(--f-hand); font-weight: 700; font-size: 1.3rem; display: grid; place-items: center; line-height: 1;
}
.outro { font-family: var(--f-hand); font-size: 1.3rem; color: var(--navy); border-top: 1.5px solid var(--line-major); padding-top: 12px; margin-bottom: 26px; }
.why { font-size: 1.15rem; line-height: 1.7; margin: 0 0 26px; }
.ok-line { display: flex; gap: 8px; align-items: center; color: var(--navy); font-weight: 700; overflow-wrap: anywhere; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: .98rem; z-index: 60;
  width: max-content; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (min-width: 720px) {
  .pnum { font-size: 1.7rem; }
  .ptitle { font-size: 1.18rem; }
}

/* ---------- Gras des 3 premières lignes (réglage) ---------- */
.bold-top .prow.top3 .ptext { font-weight: 700; }

/* ---------- Pages de la liste ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(var(--u) / 2) 0; background: var(--paper); border-top: 1.5px solid var(--line-major); }
.pager-btn { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--navy); background: var(--paper); color: var(--navy); border-radius: 999px; min-height: 48px; padding: 4px 16px 4px 8px; font-size: .95rem; }
.pager-btn.next { padding: 4px 8px 4px 16px; }
.pager-btn:disabled { opacity: .3; cursor: default; }
.pager-num { font-family: var(--f-hand); font-weight: 700; color: var(--navy); font-size: 1.15rem; text-align: center; }
.flip svg { transform: scaleX(-1); }
@media (max-width: 420px) { .pager-btn span:not(.ico) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .pager-btn, .pager-btn.next { padding: 4px 12px; } }

/* ---------- Changer la position ---------- */
.move-task { font-size: 1.05rem; margin: 0 0 6px; overflow-wrap: anywhere; color: var(--muted); }
.move-cur { font-family: var(--f-hand); font-weight: 700; color: var(--navy); font-size: 1.3rem; }
.moveform2 { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.step-btn { width: 56px; height: 56px; flex: none; border: 1.5px solid var(--navy); background: var(--paper); color: var(--navy); border-radius: 12px; font-size: 1.6rem; line-height: 1; }
.step-btn:disabled { opacity: .3; cursor: default; }
.input-pos { flex: 1; min-width: 0; text-align: center; font-family: var(--f-hand); font-weight: 700; font-size: 2rem; min-height: 64px; color: var(--navy); }
.sheet .btn-ghost.btn-block { margin-top: 0; }

/* ---------- Paramètres ---------- */
.settings .block-title { margin-top: 8px; }
.set-list { display: flex; flex-direction: column; margin: 12px 0 20px; border-top: 1px solid var(--line-major); }
.set-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 0; border-bottom: 1px solid var(--line-major); }
.set-label { font-size: 1.02rem; font-weight: 700; min-width: 0; }
.set-label.small { font-size: .9rem; color: var(--muted); font-weight: 400; margin: 0 0 6px; }
.set-row .stepper .step-btn { width: 48px; height: 48px; font-size: 1.4rem; }
.step-val { min-width: 6.5em; text-align: center; font-weight: 700; color: var(--navy); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn { min-width: 48px; min-height: 44px; border: 1.5px solid var(--line-major); background: var(--paper); color: var(--navy); border-radius: 8px; padding: 4px 10px; font-size: .95rem; }
.seg-btn.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.set-check { cursor: pointer; flex-wrap: nowrap; }
.switch { appearance: none; -webkit-appearance: none; width: 56px; height: 32px; border-radius: 999px; background: var(--line-major); position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(27, 42, 78, .3); transition: transform .15s; }
.switch:checked { background: var(--navy); }
.switch:checked::after { transform: translateX(24px); }
.preview { border: 1.5px solid var(--line-major); border-radius: 8px; overflow: hidden; margin: 0 0 6px; pointer-events: none; }
.preview .prow { grid-template-columns: 56px minmax(0, 1fr) 0 0; }
.preview .pnum { cursor: default; }
.set-links { display: flex; flex-direction: column; margin-top: 18px; border-top: 1px solid var(--line-major); }
.set-link { display: flex; justify-content: space-between; align-items: center; min-height: 56px; text-decoration: none; color: var(--navy); font-size: 1.05rem; border-bottom: 1px solid var(--line-major); padding: 0 4px; }
.set-link:hover { background: var(--wash); }

/* ---------- Grands écrans ---------- */
@media (min-width: 1024px) {
  #view { max-width: 760px; }
  .addbar .btn-add { max-width: 760px; }
}

/* ======================================================================
   Calendrier (vue facultative) — même papier, même encre
   ====================================================================== */
.viewtabs { display: flex; justify-content: flex-end; gap: 4px; margin: 6px 0 -1.5px; position: relative; z-index: 1; }
.vtab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 14px;
  border: 1px solid var(--line-major); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: var(--wash); color: var(--muted); font-size: .88rem;
}
.vtab .ico { width: 16px; height: 16px; }
.vtab.on { background: var(--paper); color: var(--navy); border-color: var(--line-major); font-weight: 700; box-shadow: 0 2px 0 var(--paper); }

.calendar { border-top: 1.5px solid var(--line-major); padding: 10px 0 8px; background: var(--paper); }
.calendar.closed { padding: 4px 0; }
.cal-nav { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.cal-nav > .ico { width: 18px; height: 18px; color: var(--muted); }
.cal-month { font-family: var(--f-hand); font-weight: 700; font-size: 1.3rem; color: var(--navy); text-transform: capitalize; flex: 1; text-align: center; }
.calendar.closed .cal-month { text-align: left; font-size: 1.05rem; }
.cal-arrow { width: 44px; height: 44px; border: 0; background: none; color: var(--navy); border-radius: 50%; display: grid; place-items: center; flex: none; }
.cal-arrow:hover { background: var(--wash); }
.cal-arrow .ico { width: 20px; height: 20px; }
.cal-toggle { border: 0; background: none; color: var(--muted); font-size: .82rem; text-decoration: underline; text-underline-offset: 3px; padding: 8px 4px; min-height: 40px; flex: none; }
.cal-grid { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-head { margin-bottom: 2px; }
.cal-wd { text-align: center; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 2px 0; }
.cal-day {
  position: relative; border: 1px solid var(--line-minor); background: var(--paper); border-radius: 6px;
  min-height: 44px; aspect-ratio: 1 / .82; max-width: 100%; padding: 3px 4px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  color: var(--ink); font-size: .78rem; line-height: 1;
}
.cal-day.empty { border-color: transparent; }
.cal-n { font-variant-numeric: tabular-nums; color: var(--muted); }
.cal-day.today .cal-n { color: var(--navy); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.cal-count {
  align-self: flex-end; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--navy); color: #fff;
  font-weight: 700; font-size: .78rem; display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.cal-day.has { border-color: var(--line-major); }
.cal-day.sel { border: 2px solid var(--navy); background: var(--wash); }
.cal-day.drop { border: 2px dashed var(--navy); background: var(--wash); transform: scale(1.06); }
.cal-day:hover { border-color: var(--navy); }
.cal-hint { font-size: .78rem; color: var(--muted); margin: 8px 0 0; }

.day { padding-bottom: 6px; }
.day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 12px 0 6px; background: var(--paper); }
.day-title { font-family: var(--f-hand); font-weight: 700; font-size: 1.35rem; color: var(--navy); margin: 0; text-transform: capitalize; }
.day-count { font-size: .85rem; color: var(--muted); }
.day-all { margin-left: auto; padding: 8px 0; }
.day-empty { color: var(--muted); padding: 24px 0 32px; text-align: center; background: var(--paper); }
.prow.occ-done .ptext { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--muted); }

.pdate { display: inline-flex; flex-wrap: wrap; gap: 2px 10px; vertical-align: middle; margin-left: 8px; font-size: .78rem; color: var(--muted); line-height: 20px; }
.pdate .ico, .pdate-i .ico { width: 14px; height: 14px; margin-right: 3px; vertical-align: -2px; }
.pdate-i { display: inline-flex; align-items: center; white-space: nowrap; }
.prow.to-date { opacity: .85; transform-origin: left center; }

.when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 4px 0 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px; border: 1px solid var(--line-major);
  border-radius: 999px; background: var(--paper); color: var(--navy); font-size: .9rem;
}
.chip .ico { width: 16px; height: 16px; }
.chip-main { border: 0; background: none; color: inherit; padding: 0; font: inherit; text-transform: capitalize; }
.chip-x { border: 0; background: none; color: var(--muted); font-size: 1.2rem; width: 28px; height: 28px; border-radius: 50%; }
.chip-x:hover { background: var(--wash); color: var(--navy); }
.link-btn.small { font-size: .9rem; padding: 8px 2px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.link-btn.small .ico { width: 16px; height: 16px; }
.link-btn.danger-soft { color: var(--danger); font-size: .95rem; }
.add-date { min-height: 44px; display: flex; align-items: center; }
.add-date .chip-main { font-size: .95rem; }

.wdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 4px 0 16px; }
.wday { min-height: 56px; border: 1.5px solid var(--line-major); border-radius: 10px; background: var(--paper); color: var(--navy); font-size: .85rem; padding: 2px; }
.wday.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.wday-s { text-transform: capitalize; overflow-wrap: anywhere; }
.pick-quick { display: flex; gap: 8px; justify-content: center; margin: 10px 0 2px; }
.note-only { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--navy); border-left: 3px solid var(--margin); padding: 2px 10px; margin: 0 0 8px; }
.note-only .ico { width: 16px; height: 16px; }
.sheet .cal-day { aspect-ratio: auto; min-height: 46px; }
.sheet .cal-month { font-size: 1.15rem; }

.linkcal .cal-app { justify-content: flex-start; margin-bottom: 8px; }
.linkcal .cal-app .ico { width: 20px; height: 20px; }
.small { font-size: .85rem; }
.linkcal .inline-field { margin: 6px 0; }
.linkcal #feedurl { font-size: .8rem; }

@media (min-width: 720px) {
  .cal-day { aspect-ratio: 1 / .62; font-size: .85rem; }
  .cal-count { min-width: 26px; height: 26px; font-size: .85rem; }
}

/* ======================================================================
   Accentuation « cahier d'écolier »
   ====================================================================== */
/* Étiquette : un morceau de ruban adhésif translucide la tient sur la couverture */
.etiquette { margin-top: 22px; }
.tape {
  position: absolute; top: -13px; left: 50%; width: 92px; height: 24px; transform: translateX(-50%) rotate(3deg);
  background: rgba(214, 222, 236, .55); border-left: 1px dashed rgba(27, 42, 78, .12); border-right: 1px dashed rgba(27, 42, 78, .12);
  box-shadow: 0 1px 2px rgba(27, 42, 78, .08); pointer-events: none;
}
.etq-in { background: linear-gradient(to bottom, transparent calc(100% - 1px), transparent 0); }
.brand { letter-spacing: .01em; }

/* La date écrite en haut de la page, comme à l'école */
.page-date {
  margin: 0; padding: calc(var(--u) / 2) 4px 0 0; text-align: right; font-family: var(--f-hand); font-size: 1.1rem;
  color: var(--navy); opacity: .8; line-height: var(--u); min-height: var(--u);
}
.notebook .page-date { padding-left: 70px; }

/* Onglets Liste / Calendrier : des intercalaires de papier */
.vtab { font-family: var(--f-hand); font-size: 1.05rem; padding: 4px 16px 2px; border-radius: 12px 12px 0 0; transform-origin: bottom; }
.vtab:not(.on) { transform: translateY(3px); }
.vtab.on { border-width: 1.5px; border-color: var(--line-major); }

/* Calendrier : une grille tracée à la règle dans le cahier */
.calendar { padding-top: 6px; }
.cal-month { font-size: 1.45rem; text-decoration: underline double; text-decoration-thickness: 1.5px; text-underline-offset: 7px; flex: 1; }
.cal-grid { gap: 0; border: 1.5px solid var(--navy); border-radius: 2px; overflow: hidden; background: var(--paper); }
.cal-row { gap: 0; }
.cal-head { margin: 0; border-bottom: 1.5px solid var(--navy); }
.cal-wd { font-family: var(--f-hand); font-size: .95rem; text-transform: none; letter-spacing: 0; color: var(--navy); padding: 4px 0 2px; }
.cal-row + .cal-row .cal-day { border-top: 1px solid var(--line-major); }
.cal-day { border: 0; border-radius: 0; border-right: 1px solid var(--line-major); padding: 4px 5px; }
.cal-row .cal-day:last-child { border-right: 0; }
.cal-day.empty { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--line-minor) 6px 7px); border-right: 1px solid var(--line-major); }
.cal-day.has { border-color: var(--line-major); }
.cal-n { font-family: var(--f-hand); font-size: .95rem; }
.cal-day.today .cal-n {
  text-decoration: none; color: var(--navy); font-weight: 700; position: relative;
}
.cal-day.today .cal-n::after { /* soulignement tracé à la main */
  content: ""; position: absolute; left: -2px; right: -2px; bottom: -3px; height: 2px; background: var(--navy); border-radius: 2px; transform: rotate(-3deg);
}
/* Le chiffre est entouré au stylo, comme une note de l'instituteur */
.cal-count {
  background: transparent; color: var(--navy); font-family: var(--f-hand); font-weight: 700; font-size: 1.05rem;
  border: 1.6px solid var(--navy); border-radius: 52% 46% 55% 44% / 48% 55% 45% 52%; min-width: 26px; height: 24px; padding: 0 4px;
  transform: rotate(-6deg); line-height: 1;
}
.cal-day.sel { border: 0; border-right: 1px solid var(--line-major); background: repeating-linear-gradient(-45deg, var(--wash) 0 4px, #E9EDF6 4px 5px); box-shadow: inset 0 0 0 2px var(--navy); }
.cal-day.drop { border: 0; box-shadow: inset 0 0 0 2px var(--navy); background: var(--wash); transform: none; }
.cal-day:hover { border-color: var(--line-major); background: var(--wash); }
.cal-hint { font-style: italic; }

/* Jour sélectionné : un titre écrit et souligné deux fois, comme une leçon */
.day-title { font-size: 1.5rem; text-decoration: underline double; text-decoration-thickness: 1.5px; text-underline-offset: 7px; }

/* Petites mentions de date : écrites au crayon */
.pdate { font-family: var(--f-hand); font-size: .9rem; }

/* Feuilles (menus) : une feuille du même cahier, avec sa marge */
.sheet { background-image: linear-gradient(to right, transparent 30px, var(--margin) 30px, var(--margin) 31.5px, transparent 31.5px); padding-left: max(46px, env(safe-area-inset-left, 0px)); }
.sheet.center { background-image: none; padding-left: 18px; }
.sheet-title { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 6px; text-decoration-color: var(--line-major); }

/* Jours de la semaine (Répéter) : des cases à cocher dessinées */
.wday { font-family: var(--f-hand); font-size: 1rem; border-radius: 4px; }
.wday.on { background: var(--paper); color: var(--navy); border: 2px solid var(--navy); position: relative; }
.wday.on::after { content: "✓"; position: absolute; top: -10px; right: -4px; font-size: 1.3rem; color: var(--navy); font-weight: 700; transform: rotate(8deg); }

/* Pastilles de date : comme une petite étiquette */
.chip { border-radius: 6px; border-style: dashed; font-family: var(--f-hand); font-size: 1rem; }

/* ======================================================================
   Une vraie liste : une ligne = une priorité, numérotée, réglée à la règle
   ====================================================================== */
.tape { display: none; }
.etiquette { margin-top: 14px; }
.notebook::before { opacity: .4; }
.page-date { padding-bottom: 4px; border-bottom: 1.5px solid var(--navy); margin-bottom: 0; }
.plist { border-top: 0; }
.prow {
  grid-template-columns: 46px minmax(0, 1fr) auto 40px 40px; align-items: center;
  min-height: max(46px, calc(var(--u) * 1.5)); border-bottom: 1px solid var(--line-major); background: transparent;
}
.prow::before { left: 46px; }
.pnum {
  font-size: 1.3rem; line-height: 1; padding: 0 10px 0 0; min-height: 44px; height: 100%;
  display: flex; align-items: center; justify-content: flex-end;
}
.ptitle {
  display: flex; align-items: center; min-width: 0; min-height: 44px; height: 100%;
  padding: 0 8px 0 12px; line-height: 1.3; font-size: 1.05rem;
}
.ptext { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; overflow-wrap: normal; }
.prow.hl .ptext { padding: 2px 6px; margin: 0 -2px; }
.pmeta { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; white-space: nowrap; padding-right: 2px; }
.pm-i { display: inline-flex; align-items: center; gap: 2px; }
.pm-i .ico { width: 15px; height: 15px; }
.pm-date { font-family: var(--f-hand); font-size: .95rem; color: var(--navy); opacity: .8; }
.phandle, .pmore { width: 40px; height: 44px; margin: 0; }
.phandle .ico, .pmore .ico { width: 20px; height: 20px; }
.prow.top3 .pnum { font-size: 1.45rem; }
@media (max-width: 380px) { .pm-date { display: none; } }
@media (min-width: 720px) {
  .prow { grid-template-columns: 56px minmax(0, 1fr) auto 44px 44px; }
  .prow::before { left: 56px; }
  .ptitle { font-size: 1.12rem; }
}
.preview .prow { grid-template-columns: 46px minmax(0, 1fr) 0 0 0; }
@media (max-width: 480px) {
  .prow { grid-template-columns: 42px minmax(0, 1fr) auto 34px 34px; }
  .prow::before { left: 42px; }
  .phandle, .pmore { width: 34px; }
}

/* ---------- Titre facultatif ---------- */
.add-heading { min-height: 40px; display: flex; align-items: center; }
.add-heading .stack { width: 100%; margin: 0 0 6px; }
.input-heading { font-family: var(--f-hand); font-size: 1.2rem; font-weight: 700; color: var(--navy); }
textarea.input-big { resize: none; overflow: hidden; line-height: 1.4; min-height: 64px; }
.head-stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.heading-input { width: 100%; }
.heading-input::placeholder { color: #A3AEC2; font-weight: 400; }
.text-input {
  width: 100%; border: 0; resize: none; overflow: hidden; background: transparent; padding: 4px; border-radius: 6px;
  font-family: var(--f-body); font-size: 1.08rem; line-height: 1.5; color: var(--ink);
}
.text-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(27, 42, 78, .1); }
.head-link { margin: 0 0 0 40px; }

/* ---------- Annuler dans le message du bas ---------- */
.toast { display: flex; align-items: center; gap: 14px; }
.toast.has-act { pointer-events: auto; }
.toast-act { border: 0; background: transparent; color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 6px 4px; min-height: 36px; flex: none; }

/* ---------- Suggestion discrète (une seule fois) : un petit mot glissé dans le cahier ---------- */
.nudge {
  position: relative; margin: 8px 0 12px; padding: 12px 44px 10px 16px; background: var(--paper);
  border: 1.5px dashed var(--line-major); border-radius: 8px; font-size: .92rem; transform: rotate(-.4deg);
  transition: opacity .2s, transform .2s;
}
.nudge.bye { opacity: 0; transform: translateY(-6px); }
.nudge p { margin: 0 0 6px; }
.nudge-t { font-family: var(--f-hand); font-weight: 700; color: var(--navy); font-size: 1.1rem; }
.nudge-a { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 4px; }
.nudge-a .btn { text-decoration: none; }
.nudge-x { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); font-size: 1.3rem; border-radius: 50%; }
.nudge-x:hover { background: var(--wash); color: var(--navy); }

.set-link.strong { font-weight: 700; }
.privacy { padding-left: 1.2em; display: flex; flex-direction: column; gap: 12px; line-height: 1.55; margin: 8px 0 18px; }

/* ---------- Téléphone : pas de poignée, le numéro suffit pour changer l'ordre ---------- */
@media (pointer: coarse) and (max-width: 820px) {
  .phandle { display: none; }
  .prow { grid-template-columns: 42px minmax(0, 1fr) auto 40px; }
  .pmore { width: 40px; }
}

/* ---------- +N en rouge : annotation du professeur (priorités passées pas encore faites) ---------- */
:root { --red-pen: #C62828; }
.red-pen { color: var(--red-pen); font-family: var(--f-hand); font-weight: 700; }
.cal-late {
  position: absolute; top: 1px; right: 4px; color: var(--red-pen); font-family: var(--f-hand); font-weight: 700;
  font-size: 1.05rem; line-height: 1; transform: rotate(-8deg); letter-spacing: -.02em;
}
@media (min-width: 720px) { .cal-late { font-size: 1.25rem; top: 3px; right: 6px; } }
.late { margin-top: 10px; }
.late-title { font-family: var(--f-hand); font-size: 1.15rem; color: var(--navy); margin: 8px 0 4px; font-weight: 700; }
.late-title .red-pen { font-size: 1.35rem; display: inline-block; transform: rotate(-6deg); margin-right: 4px; }
.late .pm-date { color: var(--red-pen); opacity: 1; }

/* Appui long sur la ligne : pas de menu de sélection du téléphone */
.plist .ptitle, .plist .pnum { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.prow.dragging { transform-origin: center; }
.prow.dragging .ptitle { background: var(--paper); }
