.layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.25rem; padding-top: 1.25rem; padding-bottom: 3rem; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 1rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
.section-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: .25rem 0 -.25rem; }

.drop { border: 2px dashed var(--line-2); border-radius: 14px; padding: 1.1rem; text-align: center; cursor: pointer; display: grid; gap: .25rem; justify-items: center; transition: .15s; background: #0d1527; }
.drop:hover, .drop.over { border-color: var(--primary); background: rgba(99,102,241,.07); }
.drop.compact { padding: .7rem; grid-auto-flow: column; justify-content: center; gap: .6rem; font-size: .85rem; }
.drop .ico { font-size: 1.6rem; }

.thumbs { display: flex; flex-wrap: wrap; gap: .4rem; }
.thumb { position: relative; width: 54px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-2); background: #0d1527; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; line-height: 18px; cursor: pointer; padding: 0; }

.mode { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .85rem; }
.mode select, .mode input { width: auto; padding: .4rem .6rem; }
.bundles { display: grid; gap: .6rem; max-height: 420px; overflow-y: auto; padding-right: .25rem; }
.bundle { border: 1px solid var(--line); border-radius: 12px; padding: .6rem; background: var(--panel-2); }
.bundle-head { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; font-weight: 600; margin-bottom: .45rem; gap: .5rem; }
.bundle-head .st { font-weight: 500; color: var(--muted); }
.bundle-head .st.err { color: var(--red); }
.bundle-pages { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.bundle-pages .thumb { cursor: default; }
.split { border: 1px dashed var(--line-2); background: none; color: var(--faint); border-radius: 8px; height: 72px; width: 22px; cursor: pointer; font-size: .8rem; padding: 0; }
.split:hover { color: var(--primary-2); border-color: var(--primary); }
.merge { font-size: .72rem; }

.progress { border: 1px solid rgba(99,102,241,.4); background: rgba(99,102,241,.08); border-radius: 12px; padding: .75rem .9rem; display: grid; gap: .5rem; }
.progress-top { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; font-size: .85rem; }
.progress-top span { color: var(--muted); }
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .4s; }
.progress-warn { font-size: .8rem; color: #fcd34d; }
.analyzing { display: grid; justify-items: center; gap: .5rem; text-align: center; padding: 1.5rem 1rem; border: 1px dashed var(--primary); border-radius: 12px; background: rgba(99,102,241,.06); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.grid-tools { display: grid; gap: .35rem; }
.grid-editor { border: 1px solid rgba(99,102,241,.45); background: rgba(99,102,241,.06); border-radius: 12px; padding: .8rem; display: grid; gap: .6rem; }
.grid-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.grid-head b { flex: 1; }
.crit { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; background: var(--panel-2); display: grid; gap: .4rem; }
.crit-top { display: grid; grid-template-columns: 1fr 5.5rem; gap: .4rem; }
.crit textarea { font-size: .8rem; }
.ok { color: var(--green); } .bad { color: var(--red); }
.summary { font-size: .85rem; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.summary b { color: var(--text); }

.results-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.results-head h2 { margin: 0; }
.results-tools { display: flex; gap: .5rem; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .75rem; }
.stat .v { font-size: 1.25rem; font-weight: 700; }
.stat .l { font-size: .72rem; color: var(--muted); }
.empty { text-align: center; padding: 3.5rem 1rem; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 14px; }

.cards { display: grid; gap: .75rem; }
.card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); overflow: hidden; }
.card.flag { border-color: rgba(245,158,11,.5); }
.card-head { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem auto auto auto; gap: .75rem; align-items: center; padding: .75rem .9rem; }
.card-head input.name { background: transparent; border-color: transparent; font-weight: 600; font-size: .95rem; padding: .35rem .5rem; }
.card-head input.name:hover, .card-head input.name:focus { border-color: var(--line-2); background: #0d1527; }
.card-head input.group { background: transparent; border-color: transparent; font-size: .8rem; color: var(--muted); padding: .3rem .45rem; }
.card-head input.group:hover, .card-head input.group:focus { border-color: var(--line-2); background: #0d1527; }
@media (max-width: 480px) { .card-head { grid-template-columns: minmax(0, 1fr) 4.5rem auto auto auto; gap: .4rem; } }
.rel { font-size: .75rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; border: 1px solid; white-space: nowrap; }
button.rel { cursor: pointer; font-family: inherit; }
.info { background: none; border: 0; color: var(--primary-2); cursor: pointer; font-size: .85rem; padding: 0 .15rem; }
.rel.hi { color: var(--green); border-color: rgba(16,185,129,.4); background: rgba(16,185,129,.1); }
.rel.mid { color: var(--amber); border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.1); }
.rel.lo { color: var(--red); border-color: rgba(244,63,94,.45); background: rgba(244,63,94,.1); }
.qtable tr.disputed td { background: rgba(245,158,11,.07); }
.qtable tr.disputed td.q::before { content: "⚖ "; color: var(--amber); }
.qtable .second { font-size: .72rem; color: var(--amber); margin-top: .25rem; }
.grade { font-size: 1.15rem; font-weight: 800; color: var(--primary-2); white-space: nowrap; }
.grade small { color: var(--muted); font-weight: 500; font-size: .8rem; }
.chev { transition: transform .15s; }
.card.open .chev { transform: rotate(180deg); }
.card-body { border-top: 1px solid var(--line); padding: .75rem .9rem 1rem; display: grid; gap: .75rem; }
.flags { display: grid; gap: .3rem; }
.flags div { font-size: .8rem; color: #fcd34d; background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.3); border-radius: 10px; padding: .4rem .6rem; }
.qtable { width: 100%; border-collapse: collapse; font-size: .82rem; }
.qtable th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; padding: .3rem .4rem; }
.qtable td { padding: .4rem; border-top: 1px solid var(--line); vertical-align: top; }
.qtable td.q { font-weight: 600; width: 28%; }
.qtable td.pts { white-space: nowrap; width: 1%; }
.qtable td.pts input { width: 4.2rem; padding: .25rem .4rem; text-align: right; }
.qtable td.just { color: var(--muted); }
.qtable tr.lost td.q { color: #fda4af; }
.comment textarea { font-size: .85rem; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .75rem; color: var(--faint); }

/* Écran d'accès */
.gate { max-width: 560px; margin: 3rem auto; display: grid; gap: 1rem; }
.gate .panel { display: grid; gap: .9rem; }
.or { text-align: center; color: var(--faint); font-size: .8rem; }
.keybox { font-family: ui-monospace, Menlo, monospace; font-size: 1.05rem; letter-spacing: .05em; text-align: center; padding: .8rem; border-radius: 12px; background: #0d1527; border: 1px dashed var(--primary); user-select: all; }
.packs { display: grid; gap: .6rem; }
.pack { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 1rem; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel-2); }
.pack b { font-size: .95rem; }
.modal { position: fixed; inset: 0; background: rgba(3,6,15,.7); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal .panel { width: min(520px, 100%); display: grid; gap: .9rem; }

/* Choix du type de correction */
.kind {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.kind-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 10px;
  background: linear-gradient(180deg, rgba(129, 140, 248, .28), rgba(99, 102, 241, .16));
  border: 1px solid rgba(165, 180, 252, .35);
  box-shadow: 0 6px 20px -8px rgba(99, 102, 241, .7), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}
.kind[data-active="lang"] .kind-pill { transform: translateX(100%); }
.kind button {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-size: .85rem; font-weight: 600; letter-spacing: -.005em; border: 0; border-radius: 10px;
  padding: .65rem .75rem; cursor: pointer; background: transparent; color: var(--muted); transition: color .2s;
}
.kind button:hover { color: var(--text); }
.kind button.active { color: #fff; }
.kind svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.kind-short { display: none; }
.ic { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.15em; flex: none; }
.ic-lg { width: 30px; height: 30px; stroke-width: 1.5; color: var(--primary-2); }
.empty-ico .ic-lg { width: 34px; height: 34px; color: var(--faint); margin-bottom: .3rem; }
@media (max-width: 480px) { .kind-long { display: none; } .kind-short { display: inline; } }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
@media (max-width: 520px) { .row3 { grid-template-columns: 1fr; } }

/* Catégories de fautes : une couleur chacune */
:root { --c-orth: #f43f5e; --c-acc: #f59e0b; --c-conj: #a855f7; --c-ponc: #38bdf8; --c-synt: #10b981; --c-voc: #94a3b8; }
.cats { display: flex; flex-wrap: wrap; gap: .4rem; }
.cat { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 500; color: var(--text); padding: .3rem .6rem; border-radius: 999px; border: 1px solid var(--line-2); background: #0d1527; cursor: pointer; }
.cat::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--dot); }
.c-orth { --dot: var(--c-orth); } .c-acc { --dot: var(--c-acc); } .c-conj { --dot: var(--c-conj); }
.c-ponc { --dot: var(--c-ponc); } .c-synt { --dot: var(--c-synt); } .c-voc { --dot: var(--c-voc); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chips .cat { cursor: default; }

/* Visionneuse de copie annotée */
.viewer-panel { width: min(1200px, 100%) !important; max-height: 92vh; display: grid; grid-template-rows: auto 1fr; }
.viewer-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; min-height: 0; overflow: hidden; }
@media (max-width: 800px) { .viewer-body { grid-template-columns: 1fr; overflow: auto; } }
.viewer-pages, .viewer-list { overflow-y: auto; display: grid; gap: .75rem; align-content: start; }
.page-wrap { position: relative; border-radius: 8px; overflow: hidden; background: #fff; width: fit-content; max-width: 100%; margin: 0 auto; }
/* Par défaut, la feuille entière tient dans la fenêtre ; un clic sur l'image agrandit à la largeur. */
.page-wrap img { display: block; max-width: 100%; max-height: calc(92vh - 9rem); width: auto; height: auto; cursor: zoom-in; }
.viewer-pages.zoom .page-wrap { width: 100%; }
.viewer-pages.zoom .page-wrap img { width: 100%; max-height: none; cursor: zoom-out; }
.zoom-hint { font-size: .75rem; color: var(--muted); text-align: center; }
.hl { position: absolute; border: 2px solid var(--dot); background: color-mix(in srgb, var(--dot) 28%, transparent); border-radius: 3px; cursor: pointer; }
.hl.focus { outline: 3px solid #fde047; z-index: 2; }
.hl span { position: absolute; top: -.95rem; left: -2px; font-size: .62rem; font-weight: 700; color: #fff; background: var(--dot); padding: 0 .25rem; border-radius: 4px; }
.err { border: 1px solid var(--line); border-left: 4px solid var(--dot); border-radius: 10px; padding: .55rem .7rem; background: var(--panel-2); font-size: .82rem; display: grid; gap: .2rem; cursor: pointer; }
.err.focus { border-color: #fde047; }
.err .fix s { color: #fda4af; } .err .fix b { color: #6ee7b7; }
.err-head { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
