/* Carnet d'anglais — esthétique « fiche bristol » : papier, encre, marge rouge */

:root {
  --paper: #F2ECDF;
  --paper-2: #E8E0CE;
  --card: #FFFCF4;
  --ink: #1B2431;
  --ink-2: #485162;
  --muted: #7C7466;
  --line: rgba(27, 36, 49, .13);
  --rule: #D3E0EB;
  --red: #CF4636;
  --yes: #2D7A58;
  --yes-soft: #DDEEE4;
  --no: #B5432E;
  --no-soft: #F5E0D9;
  --c-phrasal: #CF4636;
  --c-vocab: #2C63A8;
  --c-liaison: #A9750F;
  --c-phrases: #2D7A58;
  --c-insultes: #8E3A62;
  --c-all: #1B2431;
  --shadow-sm: 0 1px 0 rgba(27, 36, 49, .05), 0 8px 20px -12px rgba(27, 36, 49, .28);
  --shadow-lg: 0 2px 0 rgba(27, 36, 49, .04), 0 30px 60px -30px rgba(27, 36, 49, .5);
  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-ui: "Commissioner", "Segoe UI", system-ui, sans-serif;
  --f-mono: "DM Mono", ui-monospace, Consolas, monospace;
  --r: 16px;
  --tabbar-h: 64px;
  --grain-blend: multiply;
  --grain-opacity: .55;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13161B;
    --paper-2: #1C2027;
    --card: #1F242C;
    --ink: #EFE8D8;
    --ink-2: #BDB6A6;
    --muted: #8F897B;
    --line: rgba(239, 232, 216, .12);
    --rule: #28313C;
    --red: #EA6552;
    --yes: #5CC08F;
    --yes-soft: #1C3328;
    --no: #F07F66;
    --no-soft: #3B231E;
    --c-phrasal: #EA6552;
    --c-vocab: #74A6E8;
    --c-liaison: #E2AA43;
    --c-phrases: #5CC08F;
    --c-insultes: #D67EA8;
    --c-all: #EFE8D8;
    --shadow-sm: 0 8px 20px -12px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 60px -30px rgba(0, 0, 0, .85);
    --grain-blend: screen;
    --grain-opacity: .18;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  --c: var(--c-all);
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--f-ui);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42 0 0 0 0 .36 0 0 0 0 .26 0 0 0 .1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
#app { position: relative; z-index: 1; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

[data-cat="phrasal"] { --c: var(--c-phrasal); }
[data-cat="vocab"] { --c: var(--c-vocab); }
[data-cat="liaison"] { --c: var(--c-liaison); }
[data-cat="phrases"] { --c: var(--c-phrases); }
[data-cat="insultes"] { --c: var(--c-insultes); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- Barre du haut / onglets ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
  font: italic 600 17px/1 var(--f-display);
}
.brand-mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: 7px; height: 2px; background: var(--red); }
.brand-name { font: 600 15px/1.1 var(--f-ui); letter-spacing: -.01em; }
.brand-name em { font: italic 400 15px var(--f-display); color: var(--muted); }

.topnav { display: flex; gap: 4px; }
.topnav a, .tabbar a { color: var(--ink-2); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.topnav a { display: flex; align-items: center; gap: 8px; padding: 8px 15px; border-radius: 999px; font-weight: 500; font-size: 15px; }
.topnav a:hover { background: var(--paper-2); color: var(--ink); }
.topnav a.active { background: var(--ink); color: var(--paper); }
.topnav svg { width: 18px; height: 18px; }
.tabbar { display: none; }

@media (max-width: 819px) {
  .topnav { display: none; }
  .brand-name em { display: none; }
  .tabbar {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--card) 92%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 12px; font-weight: 500; }
  .tabbar a.active { color: var(--ink); font-weight: 600; }
  .tabbar a.active svg { color: var(--red); }
  .tabbar svg { width: 23px; height: 23px; }
  .page { padding-bottom: calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)) !important; }
}
body[data-route="reviser"] .topbar,
body[data-route="reviser"] .tabbar { display: none; }

/* ---------- Page ---------- */

.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 40px) 64px; }
.eyebrow { margin: 0 0 12px; font: 500 12px/1.2 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
h1 {
  margin: 0;
  font: 500 clamp(2.1rem, 5.4vw, 3.7rem)/1.02 var(--f-display);
  letter-spacing: -.025em;
  font-variation-settings: "opsz" 144;
  text-wrap: balance;
}
h1 em { font-style: italic; font-weight: 400; color: var(--red); }
.lead { max-width: 58ch; margin: 16px 0 0; color: var(--ink-2); font-size: 1.05rem; }
.section-title { margin: 44px 0 12px; font: 600 13px var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- Boutons & champs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  font: 600 16px/1 var(--f-ui);
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--ink); color: var(--paper); box-shadow: 0 12px 26px -16px var(--ink); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 86%, var(--red)); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.link { min-height: 42px; background: none; color: var(--muted); font-weight: 500; font-size: 14.5px; }
.btn.link:hover { color: var(--ink); }
.btn.danger { background: transparent; color: var(--no); border-color: color-mix(in srgb, var(--no) 40%, transparent); }
.btn.danger:hover { background: var(--no-soft); }
.btn.icon { width: 40px; min-height: 40px; padding: 0; }
kbd { font: 500 11px/1 var(--f-mono); padding: 3px 6px; border: 1px solid currentColor; border-radius: 5px; opacity: .55; }
@media (hover: none) { kbd, .kbd-help { display: none !important; } }
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

textarea, input, select {
  width: 100%;
  padding: 12px 14px;
  font: 400 16px/1.4 var(--f-ui);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus, input:focus, select:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }

/* ---------- Accueil ---------- */

.hero { margin-bottom: clamp(28px, 4vw, 44px); padding-bottom: clamp(24px, 4vw, 40px); border-bottom: 1px solid var(--line); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 24px 0 0; font: 400 13px var(--f-mono); color: var(--muted); }
.hero-stats b { margin-right: 6px; font: 600 1.4rem var(--f-display); color: var(--ink); }
.hero-stats .due b { color: var(--red); }

.step { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font: 600 13px/1 var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.step span { display: inline-grid; place-items: center; width: 22px; height: 22px; font: 500 11px var(--f-mono); border: 1px solid var(--ink-2); border-radius: 50%; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px 16px; margin-bottom: 40px; padding-top: 12px; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 158px;
  padding: 22px 18px 16px;
  font: inherit;
  color: inherit;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0 var(--r) var(--r) var(--r);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.tile-tab {
  position: absolute;
  top: -13px;
  left: -1px;
  padding: 4px 12px 3px;
  font: 500 11px/1 var(--f-mono);
  letter-spacing: .06em;
  color: var(--card);
  background: var(--c);
  border-radius: 7px 7px 0 0;
}
.tile-label { font: 600 1.2rem/1.15 var(--f-display); letter-spacing: -.01em; padding-right: 26px; }
.tile-hint { font: italic 400 14px/1.3 var(--f-display); color: var(--muted); }
.tile-count { margin-top: auto; padding-top: 14px; font: 400 12px var(--f-mono); color: var(--muted); }
.tile-count b { margin-right: 4px; font: 600 1.65rem/1 var(--f-display); color: var(--ink); }
.tile-meta { font: 400 11.5px/1.35 var(--f-mono); color: var(--muted); }
.tile-meta .due { color: var(--red); }
.tile-bar { align-self: stretch; height: 3px; margin-top: 10px; overflow: hidden; background: var(--paper-2); border-radius: 3px; }
.tile-bar i { display: block; height: 100%; background: var(--c); border-radius: inherit; }
.tile:hover { transform: translateY(-2px) rotate(-.4deg); box-shadow: var(--shadow-lg); }
.tile.selected { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), var(--shadow-lg); transform: translateY(-3px); }
.tile.selected::after {
  content: "✓";
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 13px;
  font-weight: 700;
  color: var(--card);
  background: var(--c);
  border-radius: 50%;
}
.enter .tile { animation: rise .5s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i) * 55ms); }
.enter .hero { animation: rise .5s ease backwards; }

.setup-row { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 26px 32px; margin-bottom: 34px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; }
.seg button {
  padding: 10px 17px;
  font: 500 14.5px var(--f-ui);
  color: var(--ink-2);
  white-space: nowrap;
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--paper); }
.btn.start { width: 100%; min-height: 62px; font-size: 18px; border-radius: 18px; }

@media (min-width: 720px) {
  .btn.start { width: auto; min-width: 360px; }
}
@media (max-width: 720px) {
  .setup-row { grid-template-columns: 1fr; }
  .seg { display: flex; }
  .seg button { flex: 1; padding: 10px 6px; font-size: 14px; }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 24px 10px; }
  .tile { min-height: 134px; padding: 18px 12px 12px; }
  .tile-label { font-size: 1.02rem; padding-right: 18px; }
  .tile-hint { display: none; }
  .tile-meta .extra { display: none; }
  .tile.selected::after { top: 10px; right: 8px; width: 20px; height: 20px; font-size: 11px; }
}

/* ---------- Session de révision ---------- */

.page-reviser { max-width: 720px; padding-top: 0 !important; padding-bottom: 0 !important; }
.session {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 8px;
  min-height: 100dvh;
  padding: calc(12px + env(safe-area-inset-top)) 0 calc(14px + env(safe-area-inset-bottom));
}
.session-bar { display: flex; align-items: center; gap: 14px; }
.quit { min-height: 40px; padding: 0 14px; font-size: 14px; }
.progress { flex: 1; height: 6px; overflow: hidden; background: var(--paper-2); border-radius: 6px; }
.progress i { display: block; width: 0; height: 100%; background: var(--red); border-radius: inherit; transition: width .35s ease; }
.counter { min-width: 58px; font: 500 13px var(--f-mono); color: var(--muted); text-align: right; }

.stage { display: grid; place-items: center; padding: 10px 0; }
.flash {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: min(56dvh, 440px);
  padding: 0 clamp(20px, 5vw, 44px) 34px;
  background:
    linear-gradient(var(--c), var(--c)) 0 62px / 100% 2px no-repeat,
    repeating-linear-gradient(180deg, transparent 0 37px, var(--rule) 37px 38px) 0 64px / 100% calc(100% - 64px) no-repeat,
    var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  animation: card-in .42s cubic-bezier(.2, .8, .2, 1) backwards;
  transition: transform .26s cubic-bezier(.4, 0, .6, 1), opacity .26s ease, box-shadow .2s ease;
}
@keyframes card-in { from { opacity: 0; transform: translateY(26px) rotate(-1.2deg); } }
.flash.revealed { cursor: grab; }
.flash.dragging { cursor: grabbing; transition: none; }
.flash[data-lean="yes"] { box-shadow: 0 0 0 3px var(--yes), var(--shadow-lg); }
.flash[data-lean="no"] { box-shadow: 0 0 0 3px var(--no), var(--shadow-lg); }
.flash.fly-right { transform: translateX(115%) rotate(10deg); opacity: 0; }
.flash.fly-left { transform: translateX(-115%) rotate(-10deg); opacity: 0; }
.flash.fly-up { transform: translateY(-40px) scale(.94); opacity: 0; }

.flash-head { display: flex; align-items: center; gap: 12px; height: 62px; min-width: 0; }
.stamp {
  display: inline-grid;
  flex: none;
  place-items: center;
  min-width: 38px;
  height: 26px;
  padding: 0 8px;
  font: 500 12px/1 var(--f-mono);
  letter-spacing: .1em;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  transform: rotate(-3deg);
}
.stamp.alt { color: var(--red); border-color: var(--red); transform: rotate(2deg); }
.flash-cat { overflow: hidden; font: 500 12px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; color: var(--c); }
.retry { flex: none; padding: 3px 8px; font: 500 11px var(--f-mono); color: var(--no); background: var(--no-soft); border-radius: 999px; }
.dots { display: flex; flex: none; gap: 4px; margin-left: auto; }
.dots i { width: 7px; height: 7px; border: 1px solid var(--muted); border-radius: 50%; }
.dots i.on { background: var(--c); border-color: var(--c); }

.prompt {
  margin: auto 0 0;
  padding-top: 30px;
  font: 600 clamp(2.1rem, 7vw, 3.5rem)/1.08 var(--f-display);
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
  font-variation-settings: "opsz" 144;
  text-wrap: balance;
}
.flash.medium .prompt { font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.15; }
.flash.long .prompt { font-size: clamp(1.25rem, 3.8vw, 1.75rem); line-height: 1.28; font-weight: 500; }
.answer {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 24px 0 auto;
  opacity: 0;
  filter: blur(4px);
  transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease, filter .3s ease;
}
.answer .stamp { margin-top: 4px; }
.answer p { margin: 0; font: italic 400 clamp(1.4rem, 4.6vw, 2.1rem)/1.22 var(--f-display); color: var(--red); overflow-wrap: anywhere; }
.flash.long .answer p { font-size: clamp(1.1rem, 3.4vw, 1.5rem); }
.flash.revealed .answer { opacity: 1; filter: none; transform: none; }
.tap-hint { position: absolute; left: 0; right: 0; bottom: 12px; margin: 0; font: 400 12px var(--f-mono); text-align: center; color: var(--muted); }
@media (hover: hover) { .tap-hint { display: none; } }

.actions { display: grid; gap: 4px; }
.actions .reveal { min-height: 62px; font-size: 18px; border-radius: 18px; }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; animation: rise .22s ease backwards; }
.grade .btn { min-height: 62px; padding: 0 12px; font-size: 17px; border-radius: 18px; }
.btn.no { color: var(--no); background: var(--no-soft); }
.btn.no:hover { background: color-mix(in srgb, var(--no-soft) 80%, var(--no)); }
.btn.yes { color: var(--card); background: var(--yes); }
.btn.yes:hover { background: color-mix(in srgb, var(--yes) 88%, var(--ink)); }
.kbd-help { margin: 2px 0 0; font: 400 12px var(--f-mono); text-align: center; color: var(--muted); }

.done { grid-row: 1 / -1; align-self: center; padding: 40px 0; text-align: center; animation: rise .5s ease backwards; }
.score { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 34px 0; }
.score div { padding: 18px 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.score b { display: block; font: 600 2.6rem/1.05 var(--f-display); }
.score div:nth-child(1) b { color: var(--yes); }
.score div:nth-child(2) b { color: var(--no); }
.score span { font: 400 12px var(--f-mono); color: var(--muted); }
.done-actions { display: grid; gap: 10px; max-width: 360px; margin: 0 auto; }

/* ---------- Ajouter ---------- */

.page-ajouter, .page-liste { max-width: 880px; }
.add-form { display: grid; gap: 12px; margin: 30px 0 22px; }
.add-form textarea { min-height: 96px; padding: 18px; font: 500 1.35rem/1.3 var(--f-display); resize: vertical; box-shadow: var(--shadow-sm); }
@media (min-width: 720px) {
  .add-form { grid-template-columns: 1fr auto; }
  .add-form .btn { min-height: auto; }
}
.mini-card {
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--c);
  border-radius: 4px 4px var(--r) var(--r);
  box-shadow: var(--shadow-sm);
  animation: rise .35s ease backwards;
}
.mini-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 12px; font: 500 12px var(--f-mono); color: var(--muted); }
.mini-status .ok { color: var(--yes); }
.mini-status .dup { color: var(--no); }
.cat-chip { color: var(--c); text-transform: uppercase; letter-spacing: .06em; }
.mini-line { display: flex; align-items: baseline; gap: 12px; margin: 8px 0; font: 500 1.3rem/1.25 var(--f-display); overflow-wrap: anywhere; }
.mini-line.fr { font-style: italic; font-weight: 400; color: var(--red); }
.mini-note { margin: 12px 0 0; padding: 8px 12px; font-size: 14px; color: var(--ink-2); background: var(--paper-2); border-radius: 10px; }
.mini-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ---------- Liste ---------- */

.list-tools {
  position: sticky;
  top: 63px;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 230px 170px;
  gap: 10px;
  margin: 26px 0 8px;
  padding: 10px 0;
  background: var(--paper);
}
.list-count { margin: 0 0 10px; font: 400 12px var(--f-mono); color: var(--muted); }
.rows { margin: 0; padding: 0; overflow: hidden; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.rows li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 18px;
  padding: 13px 16px 13px 20px;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 3px 0 0 var(--c);
  cursor: pointer;
}
.rows li:last-child { border-bottom: 0; }
.rows li:hover, .rows li:focus-visible { background: var(--paper-2); outline: none; }
.row-en { font: 500 1.06rem/1.3 var(--f-display); overflow-wrap: anywhere; }
.row-fr { font-size: 15px; color: var(--ink-2); overflow-wrap: anywhere; }
.badge { padding: 2px 8px; font: 500 11px var(--f-mono); white-space: nowrap; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; }
.badge.ok { color: var(--yes); border-color: color-mix(in srgb, var(--yes) 45%, transparent); }
.badge.warn { color: var(--no); border-color: color-mix(in srgb, var(--no) 45%, transparent); }
.rows .empty { display: block; color: var(--muted); box-shadow: none; cursor: default; }
.more { display: flex; margin: 18px auto 0; }
.logout { display: flex; margin: 40px auto 0; }

@media (max-width: 819px) {
  .list-tools { top: 0; grid-template-columns: 1fr 1fr; }
  .list-tools .search { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .rows li { grid-template-columns: minmax(0, 1fr) auto; }
  .row-fr { grid-row: 2; grid-column: 1; }
  .badge { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
}

/* ---------- Fenêtre d'édition ---------- */

dialog {
  width: min(560px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 0;
  color: var(--ink);
  background: var(--card);
  border: 0;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(15, 18, 24, .45); backdrop-filter: blur(3px); }
dialog[open] { animation: rise .25s ease backwards; }
.editor { display: grid; gap: 14px; padding: 20px; }
.editor header { display: flex; align-items: center; justify-content: space-between; }
.editor header .eyebrow { margin: 0; }
.editor label { display: grid; gap: 6px; font: 600 12px var(--f-ui); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.editor label.check { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink); }
.editor .check input { width: 20px; height: 20px; accent-color: var(--yes); }
.editor-stats { margin: 0; font: 400 12px var(--f-mono); color: var(--muted); }
.editor footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
@media (max-width: 640px) {
  dialog { width: 100vw; max-height: 92dvh; margin: auto 0 0; padding-bottom: env(safe-area-inset-bottom); border-radius: 20px 20px 0 0; }
}

/* ---------- Connexion, chargement, messages ---------- */

.login { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.login-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(380px, 100%);
  padding: 38px 28px 30px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px 22px 22px 22px;
  box-shadow: var(--shadow-lg);
  animation: rise .5s ease backwards;
}
.login-card h1 { margin-bottom: 12px; }
.login-card .eyebrow { margin: 8px 0 0; }
.login-card input, .login-card .btn { width: 100%; }
.login-error { min-height: 1.4em; margin: 0; font-size: 14px; color: var(--no); }
.brand-mark.big { width: 64px; height: 64px; font-size: 30px; border-radius: 16px; }
.brand-mark.big::after { bottom: 13px; height: 3px; }
.boot { display: grid; place-items: center; min-height: 100dvh; }
.boot .brand-mark { width: 56px; height: 56px; font-size: 26px; border-radius: 14px; animation: pulse 1.2s ease-in-out infinite; }

#toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 24px);
  padding: 12px 12px 12px 18px;
  font-size: 15px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity .2s ease, transform .2s ease;
}
#toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
#toast button { flex: none; padding: 8px 12px; font: 600 14px var(--f-ui); color: var(--paper); background: color-mix(in srgb, var(--paper) 16%, transparent); border: 0; border-radius: 10px; cursor: pointer; }
@media (max-width: 819px) {
  body:not([data-route="reviser"]) #toast { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); }
}
/* Pendant la révision, le message s'affiche en haut pour ne pas masquer les boutons */
body[data-route="reviser"] #toast { top: calc(62px + env(safe-area-inset-top)); bottom: auto; transform: translate(-50%, -20px); }
body[data-route="reviser"] #toast.show { transform: translate(-50%, 0); }

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