/* redv_admin — DA Borderless (même langage que redv_hud et la sacoche vorp_inventory)
   Voile sombre à peine rougi aux bords d'encre déchirés (texture d'origine en masque 9 parts, les bords
   gardent leur épaisseur quand on redimensionne). Texte blanc à ombre dure, RDR Lino pour l'interface,
   EB Garamond pour le texte courant. Le rouge Borderless ne sert qu'à la sélection (trait de pinceau) et à
   l'action principale ; ambre = attention. Angles droits, touches blanches façon invites RDR. */

/* le « · » de Lino est un carré : on le laisse à la police suivante */
@font-face { font-family: "RDR Lino"; src: url("fonts/crock.ttf") format("truetype"); font-display: block; unicode-range: U+0000-00B6, U+00B8-FFFF; }
@font-face { font-family: "EB Garamond"; src: url("fonts/EBGaramond-Regular.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "EB Garamond"; src: url("fonts/EBGaramond-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: block; }

:root {
    /* Espacements (grille 4 px) */
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

    /* Typo : Lino pour l'interface, Garamond pour le texte */
    --lino: "RDR Lino", "Chinese Rocks Rg", Georgia, serif;
    --font: "EB Garamond", Georgia, serif;
    --serif: var(--lino);
    --mono: Consolas, "Courier New", monospace;
    --t12: 13px; --t13: 14px; --t14: 15px; --t16: 17px; --t20: 22px; --t24: 28px;

    /* Couleurs Borderless */
    --red: 120, 31, 50;          /* #781f32 */
    --scrim: 23, 45, 69;           /* #172d45 */
    --shade: rgba(23, 45, 69, .9);
    --alpha: 0.94;                      /* opacité du voile (plus dense que la sacoche : beaucoup de texte) */

    --text:  #d8c6a6;
    --muted: rgba(216, 198, 166, .78);
    --faint: rgba(216, 198, 166, .42);
    --line:  rgba(216, 198, 166, 0.12);
    --line2: rgba(216, 198, 166, 0.24);
    --well:  rgba(23, 45, 69, 0.28);        /* creux (cases, champs) */
    --raise: rgba(216, 198, 166, 0.06);  /* relief (cartes) */
    --hover: rgba(216, 198, 166, 0.1);

    --accent:     rgb(var(--red));
    --accent-ink: #d8c6a6;
    --accent-dim: rgba(var(--red), 0.3);
    --danger:     #d8c6a6;
    --danger-dim: rgba(var(--red), 0.22);
    --warn:       #d8c6a6;
    --ok:         #d8c6a6;
    --ok-dim:     rgba(216, 198, 166, 0.12);
    --info:       #d8c6a6;

    /* Textures d'origine utilisées comme formes */
    --tex-panel: url("img/dialog_bg.png");
    --tex-ink:   url("img/tooltip.png");
    --tex-brush: url("img/dropdown.png");
    --tex-rule:  url("img/divider_line.png");

    --r1: 0; --r2: 0; --r3: 0;
    --shadow: 0 6px 18px rgba(23, 45, 69, 0.45);
    --ts: 1px 1px 0 var(--shade);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%; height: 100%;
    background: transparent;
    font-family: var(--font);
    font-size: var(--t14);
    color: var(--text);
    overflow: hidden;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; filter: drop-shadow(1px 1px 0 var(--shade)); }
kbd {
    display: inline-block; min-width: 20px; padding: 3px 6px 1px;
    background: #d8c6a6; color: rgb(var(--scrim));
    border: 0; border-radius: 3px;
    font-family: var(--lino); font-size: 12px; line-height: 1; text-align: center; text-shadow: none;
    box-shadow: 1px 1px 0 var(--shade);
}
.hidden { display: none !important; }

/* Voile aux bords déchirés, réutilisé par toutes les fenêtres (masque 9 parts : bords fixes, centre étiré) */
.panel, .dialog, .palette, .toast, .hud { isolation: isolate; }
.panel::before, .dialog::before, .palette::before, .toast::before, .hud::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(var(--red), 0.16), transparent 60%),
        linear-gradient(180deg, rgba(var(--scrim), var(--alpha)), rgba(var(--scrim), calc(var(--alpha) + 0.08)));
    -webkit-mask-box-image: var(--tex-panel) 40 / 26px stretch;
}
.toast::before, .hud::before { -webkit-mask-box-image: var(--tex-ink) 30 / 14px stretch; }
/* Fenêtres posées par-dessus le menu (dialogues, palette) : liseré ivoire qui suit le bord déchiré */
.dialog::after, .palette::after {
    content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
    background: rgba(216, 198, 166, 0.6);
    -webkit-mask-box-image: var(--tex-panel) 40 / 26px stretch;
}
.dialog::before, .palette::before { inset: 2px; }

/* Filet blanc au pinceau */
.rule, .side-foot::before, .dialog footer::before, .composer::before {
    content: ""; display: block; height: 2px;
    background: rgba(216, 198, 166, 0.7);
    -webkit-mask: var(--tex-rule) center / 100% 100% no-repeat;
}

/* ---------------------------------------------------------------- Panneau */
.app {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: none;   /* pas de voile plein écran derrière le menu */
    animation: fade 180ms var(--ease);
}
.panel {
    zoom: var(--z, 1);
    width: min(1280px, calc(92vw / var(--z, 1))); height: min(760px, calc(88vh / var(--z, 1)));
    display: grid; grid-template-columns: 224px 1fr;
    padding: 14px 16px;
    background: none;
    text-shadow: var(--ts);
    animation: rise 200ms var(--ease);
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------- Barre latérale */
.side {
    display: flex; flex-direction: column;
    padding: var(--s5) var(--s3) var(--s4);
    background: linear-gradient(90deg, rgba(23, 45, 69, 0.22), rgba(23, 45, 69, 0.08));
    box-shadow: inset -1px 0 0 var(--line);
}
.brand { display: flex; flex-direction: column; align-items: center; gap: var(--s1); padding: 0 0 var(--s5); text-align: center; }
.logo {
    position: relative; padding: 5px 12px 2px;
    font-family: var(--lino); font-size: var(--t20); font-weight: 400; line-height: 1; letter-spacing: 0.02em; white-space: nowrap;
    color: #d8c6a6; text-shadow: none;
    filter: url(#rvInk);
}
.logo::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: var(--accent);
    -webkit-mask: var(--tex-brush) center / 100% 100% no-repeat;
}
.role { font-family: var(--font); font-style: italic; font-size: var(--t13); color: var(--muted); text-align: center; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
    position: relative; isolation: isolate;
    display: flex; align-items: center; gap: var(--s3);
    height: 40px; padding: 0 var(--s3);
    border: 0; background: transparent;
    font-family: var(--lino); font-size: var(--t16); line-height: 1;
    color: var(--muted); text-align: left; cursor: pointer;
    transition: color 150ms;
}
.nav-item::before {
    content: ""; position: absolute; inset: 2px -4px; z-index: -1;
    background: var(--hover); opacity: 0;
    -webkit-mask: var(--tex-brush) center / 100% 100% no-repeat;
    transition: opacity 150ms, background 150ms;
}
.nav-item:hover { color: var(--text); }
.nav-item:hover::before { opacity: 1; }
.nav-item.active { color: #d8c6a6; }
.nav-item.active::before { opacity: 1; background: var(--accent); }
.nav-item > span:not(.count) { flex: 1; padding-top: 2px; }
.count {
    min-width: 22px; padding: 3px 6px 1px;
    background: var(--well); box-shadow: inset 0 0 0 1px var(--line2);
    color: var(--muted); font-family: var(--lino); font-size: var(--t12); line-height: 1.1; text-align: center;
}
.count.hot { background: #d8c6a6; color: rgb(var(--scrim)); box-shadow: none; text-shadow: none; }
.nav-item.active .count { background: rgba(23, 45, 69, 0.3); color: #d8c6a6; box-shadow: none; }
.nav-item.active .count.hot { background: #d8c6a6; color: rgb(var(--scrim)); }
.side-foot { display: grid; gap: var(--s2); padding: 0 var(--s2); color: var(--faint); font-size: var(--t12); }
.side-foot::before { margin: 0 calc(-1 * var(--s1)) var(--s3); opacity: 0.6; }

/* ---------------------------------------------------------------- Contenu */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
    height: 68px; padding: 6px var(--s5) 0;
}
.top::after {
    content: ""; position: absolute; left: var(--s4); right: var(--s4); bottom: 0; height: 2px;
    background: rgba(216, 198, 166, 0.75);
    -webkit-mask: var(--tex-rule) center / 100% 100% no-repeat;
}
.top h1 { font-family: var(--lino); font-size: var(--t24); font-weight: 400; line-height: 1; letter-spacing: 0.02em; filter: url(#rvInk); }
.search-btn {
    display: flex; align-items: center; gap: var(--s2);
    width: 320px; height: 36px; padding: 0 var(--s2) 0 var(--s3);
    background: rgba(23, 45, 69, 0.32); border: 0; box-shadow: inset 0 -1.5px 0 rgba(216, 198, 166, 0.45);
    color: var(--faint); font-style: italic; cursor: pointer; transition: box-shadow 150ms, color 150ms;
}
.search-btn:hover { box-shadow: inset 0 -1.5px 0 #d8c6a6; color: var(--muted); }
.search-btn span { flex: 1; text-align: left; }
.view { flex: 1; min-height: 0; overflow: auto; padding: var(--s5); }
.view.split { display: grid; grid-template-columns: 340px 1fr; gap: 0; padding: 0; overflow: hidden; }

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(216, 198, 166, 0.45); }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------------------------------------------------------------- Liste joueurs */
.list-col { display: flex; flex-direction: column; min-height: 0; box-shadow: inset -1px 0 0 var(--line); }
.list-head { padding: var(--s4); box-shadow: inset 0 -1px 0 var(--line); }
.list { flex: 1; overflow: auto; padding: var(--s2); }
.row {
    display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: var(--s3);
    width: 100%; min-height: 52px; padding: var(--s2) var(--s3);
    border: 0; background: transparent;
    text-align: left; cursor: pointer; transition: background 120ms;
}
.row:hover { background: var(--hover); }
.row.active { background: rgba(216, 198, 166, 0.12); box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px var(--line); }
.row:focus-visible { outline: 1.5px solid #d8c6a6; outline-offset: -2px; }
.pid { font-family: var(--lino); font-variant-numeric: tabular-nums; color: var(--faint); font-size: var(--t14); }
.who { min-width: 0; }
.who b { display: block; font-family: var(--lino); font-weight: 400; font-size: var(--t16); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { display: block; color: var(--faint); font-style: italic; font-size: var(--t13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; align-items: center; gap: var(--s2); color: var(--faint); font-size: var(--t12); font-variant-numeric: tabular-nums; }
.empty { padding: var(--s7) var(--s5); color: var(--faint); font-style: italic; font-size: var(--t16); text-align: center; line-height: 1.5; }

/* ---------------------------------------------------------------- Badges */
.badge {
    display: inline-flex; align-items: center; height: 20px; padding: 2px var(--s2) 0;
    font-family: var(--lino); font-size: var(--t12); font-weight: 400; letter-spacing: 0.03em; line-height: 1;
    background: var(--well); box-shadow: inset 0 0 0 1px var(--line2); color: var(--muted);
}
.badge.staff { position: relative; isolation: isolate; background: none; box-shadow: none; color: #d8c6a6; padding: 2px 10px 0; }
.badge.staff::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent); -webkit-mask: var(--tex-brush) center / 100% 100% no-repeat; }
.badge.warn  { color: var(--warn); box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.5); }
.badge.ok    { color: var(--ok); box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.5); }

/* ---------------------------------------------------------------- Fiche joueur */
.detail { overflow: auto; padding: var(--s5); }
.d-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.d-head h2 { font-family: var(--lino); font-size: var(--t24); font-weight: 400; line-height: 1.1; filter: url(#rvInk); }
.d-head p { margin-top: var(--s1); color: var(--muted); font-style: italic; }
.d-tags { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s2); margin-bottom: var(--s5); }
.stat { padding: var(--s3); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
.stat small { display: block; color: var(--faint); font-style: italic; font-size: var(--t13); margin-bottom: 2px; }
.stat b { font-family: var(--lino); font-size: var(--t20); font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums; }

.section { margin-bottom: var(--s5); }
.section h3, .p-group {
    display: flex; align-items: center; gap: var(--s3);
    margin-bottom: var(--s2);
    font-family: var(--lino); font-size: var(--t14); font-weight: 400; letter-spacing: 0.04em;
    color: var(--muted); text-transform: none;
}
.section h3::after {
    content: ""; flex: 1; height: 1.5px; opacity: 0.35;
    background: #d8c6a6; -webkit-mask: var(--tex-rule) center / 100% 100% no-repeat;
}
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.actions.c2 { grid-template-columns: repeat(2, 1fr); }
.actions.c4 { grid-template-columns: repeat(4, 1fr); }

/* ---------------------------------------------------------------- Boutons */
.btn {
    position: relative; isolation: isolate;
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
    height: 40px; padding: 2px var(--s4) 0;
    background: var(--well); border: 0; box-shadow: inset 0 0 0 1px var(--line2);
    font-family: var(--lino); font-size: var(--t16); line-height: 1;
    color: var(--text); cursor: pointer; white-space: nowrap;
    transition: background 120ms, box-shadow 120ms, color 120ms, transform 120ms;
}
.btn svg { margin-top: -2px; }
.btn:hover { background: var(--hover); box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.6); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .nav-item:focus-visible, .chip:focus-visible, .tab:focus-visible, .toggle:focus-visible, .check:focus-visible { outline: 1.5px solid #d8c6a6; outline-offset: 2px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.tile { justify-content: flex-start; }
.btn.tile svg { color: var(--muted); }
.btn.tile:hover svg { color: #d8c6a6; }
.btn.primary, .btn.solid-danger { background: var(--accent); box-shadow: none; color: #d8c6a6; }
.btn.primary:hover, .btn.solid-danger:hover { background: var(--accent); filter: brightness(1.15); box-shadow: none; }
.btn.danger { color: var(--danger); }
.btn.danger svg { color: var(--danger); }
.btn.danger:hover { background: var(--accent); color: #d8c6a6; box-shadow: none; }
.btn.danger:hover svg { color: #d8c6a6; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 32px; padding: 2px var(--s3) 0; font-size: var(--t14); }
.btn.on { background: var(--accent-dim); box-shadow: inset 0 0 0 1px rgba(var(--red), 0.9); }
.btn.on svg { color: #d8c6a6; }

/* ---------------------------------------------------------------- Champs */
.field {
    width: 100%; height: 38px; padding: 0 var(--s3);
    background: rgba(23, 45, 69, 0.32); border: 0; border-bottom: 1.5px solid rgba(216, 198, 166, 0.5);
    outline: none; transition: border-color 120ms;
    font-family: var(--font); font-size: var(--t16); text-shadow: none;
    user-select: text;
}
.field:focus { border-bottom-color: #d8c6a6; }
.field::placeholder { color: var(--faint); font-style: italic; }
textarea.field { height: auto; min-height: 88px; padding: var(--s2) var(--s3); resize: vertical; line-height: 1.4; }
select.field { cursor: pointer; }
select.field option { background: rgb(var(--scrim)); color: #d8c6a6; }
.search-field { position: relative; }
.search-field svg { position: absolute; left: var(--s3); top: 11px; color: var(--muted); }
.search-field .field { padding-left: 36px; }

.form { display: grid; gap: var(--s4); }
.form .fld { display: grid; gap: 6px; font-family: var(--lino); font-size: var(--t14); color: var(--muted); }
.form .fld .field, .form .fld .chips { color: var(--text); font-size: var(--t16); }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.form .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s3); }
.hint { font-family: var(--font); font-style: italic; font-size: var(--t13); color: var(--faint); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
    position: relative; isolation: isolate;
    height: 32px; padding: 2px var(--s3) 0;
    background: var(--well); border: 0; box-shadow: inset 0 0 0 1px var(--line2);
    font-family: var(--lino); font-size: var(--t14); line-height: 1;
    color: var(--muted); cursor: pointer; transition: color 120ms, box-shadow 120ms;
}
.chip:hover { color: var(--text); box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.6); }
.chip.active { background: none; box-shadow: none; color: #d8c6a6; }
.chip.active::before { content: ""; position: absolute; inset: 0 -3px; z-index: -1; background: var(--accent); -webkit-mask: var(--tex-brush) center / 100% 100% no-repeat; }

/* Autocomplétion */
.combo { position: relative; }
.combo-list {
    position: absolute; z-index: 5; left: 0; right: 0; top: 42px;
    max-height: 240px; overflow: auto; padding: var(--s1);
    background: rgba(var(--scrim), 0.97); box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.5), var(--shadow);
    text-shadow: var(--ts);
}
.combo-opt { display: flex; justify-content: space-between; gap: var(--s3); padding: 6px var(--s3) 4px; font-family: var(--lino); cursor: pointer; }
.combo-opt small { color: var(--faint); font-family: var(--font); font-style: italic; }
.combo-opt.active, .combo-opt:hover { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent); }

/* ---------------------------------------------------------------- Cartes / grilles */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.card { padding: var(--s4); background: var(--raise); box-shadow: inset 0 0 0 1px var(--line); }
.card h3 { margin-bottom: var(--s1); font-family: var(--lino); font-size: var(--t20); font-weight: 400; line-height: 1.1; }
.card > p { margin-bottom: var(--s4); color: var(--muted); font-style: italic; font-size: var(--t14); line-height: 1.4; }
.card + .card { margin-top: var(--s4); }
.grid2 > .card + .card { margin-top: 0; }

.toggle {
    display: flex; align-items: center; gap: var(--s3);
    width: 100%; min-height: 64px; padding: var(--s3) var(--s4);
    background: var(--well); border: 0; box-shadow: inset 0 0 0 1px var(--line);
    text-align: left; cursor: pointer; transition: box-shadow 150ms, background 150ms;
}
.toggle:hover { box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.5); }
.toggle .t-txt { flex: 1; }
.toggle b { display: block; font-family: var(--lino); font-size: var(--t16); font-weight: 400; line-height: 1.2; }
.toggle small { color: var(--faint); font-style: italic; font-size: var(--t13); }
.switch { position: relative; flex-shrink: 0; width: 38px; height: 20px; background: rgba(23, 45, 69, 0.45); box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.4); transition: background 150ms, box-shadow 150ms; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 12px; height: 12px; background: var(--muted); transition: transform 150ms var(--ease), background 150ms; }
.toggle.on { background: var(--accent-dim); box-shadow: inset 0 0 0 1px rgba(var(--red), 0.9); }
.toggle.on .switch { background: var(--accent); box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.6); }
.toggle.on .switch::after { transform: translateX(18px); background: #d8c6a6; }

.kv { display: grid; grid-template-columns: 90px 1fr auto; gap: var(--s2) var(--s3); align-items: center; font-size: var(--t14); }
.kv span { color: var(--faint); font-family: var(--lino); }
.kv code { font-family: var(--mono); font-size: var(--t12); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: text; }

/* ---------------------------------------------------------------- Tableaux */
.table { width: 100%; border-collapse: collapse; font-size: var(--t14); }
.table th {
    position: sticky; top: 0; z-index: 1; padding: var(--s2) var(--s3) 6px;
    background: rgba(var(--scrim), 0.97); color: var(--muted);
    font-family: var(--lino); font-weight: 400; font-size: var(--t14); text-align: left; letter-spacing: 0.03em;
    box-shadow: inset 0 -1.5px 0 rgba(216, 198, 166, 0.4);
}
.table td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--hover); }
.table .muted { color: var(--faint); white-space: nowrap; }
.toolbar { display: flex; gap: var(--s2); margin-bottom: var(--s4); }
.toolbar .search-field { flex: 1; }

.history { display: grid; gap: var(--s1); }
.h-item { display: grid; grid-template-columns: 96px 1fr auto; gap: var(--s3); padding: var(--s2) var(--s3); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--t14); }
.h-item small { color: var(--faint); font-style: italic; }

.report { display: grid; grid-template-columns: 1fr auto; gap: var(--s3); align-items: center; }
.report p { margin-top: var(--s2); line-height: 1.45; user-select: text; }
.report .r-acts { display: flex; gap: var(--s2); }

/* ---------------------------------------------------------------- Modal / palette */
.overlay {
    position: fixed; inset: 0; z-index: 10;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 14vh;
    background: none;   /* pas de voile plein écran : le liseré suffit à détacher la fenêtre */
    animation: fade 150ms var(--ease);
}
.dialog {
    position: relative;
    zoom: var(--z, 1);
    width: min(480px, calc(92vw / var(--z, 1)));
    padding: 10px 12px;
    background: none; text-shadow: var(--ts);
    filter: drop-shadow(0 6px 14px rgba(23, 45, 69, 0.5));
    animation: rise 180ms var(--ease);
}
.dialog.wide { width: min(660px, calc(92vw / var(--z, 1))); }
.dialog header { padding: var(--s5) var(--s5) 0; text-align: center; }
.dialog header h2 { font-family: var(--lino); font-size: var(--t24); font-weight: 400; line-height: 1.1; filter: url(#rvInk); }
.dialog header p { margin-top: var(--s1); color: var(--muted); font-style: italic; font-size: var(--t14); }
.dialog .body { padding: var(--s5); }
.dialog.wide .body { max-height: calc(56vh / var(--z, 1)); overflow: auto; }
.dialog footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); padding: 0 var(--s5) var(--s5); }
.dialog footer::before { flex: 0 0 100%; margin-bottom: var(--s3); opacity: 0.5; }

.palette {
    position: relative;
    zoom: var(--z, 1);
    width: min(620px, calc(92vw / var(--z, 1))); padding: 12px 14px;
    background: none; text-shadow: var(--ts);
    filter: drop-shadow(0 6px 14px rgba(23, 45, 69, 0.5));
    animation: rise 160ms var(--ease);
}
.palette input {
    width: 100%; height: 54px; padding: 0 var(--s5);
    background: transparent; border: 0; outline: none;
    box-shadow: inset 0 -1.5px 0 rgba(216, 198, 166, 0.45);
    font-family: var(--font); font-size: var(--t20); user-select: text;
}
.palette input::placeholder { color: var(--faint); font-style: italic; }
.p-list { max-height: calc(50vh / var(--z, 1)); overflow: auto; padding: var(--s2); }
.p-item { position: relative; isolation: isolate; display: flex; align-items: center; gap: var(--s3); height: 42px; padding: 2px var(--s3) 0; font-family: var(--lino); font-size: var(--t16); cursor: pointer; }
.p-item svg { color: var(--muted); }
.p-item span { flex: 1; }
.p-item small { color: var(--faint); font-family: var(--font); font-style: italic; font-size: var(--t13); }
.p-item:hover { background: var(--hover); }
.p-item.active { background: none; }
.p-item.active::before { content: ""; position: absolute; inset: 2px -4px; z-index: -1; background: var(--accent); -webkit-mask: var(--tex-brush) center / 100% 100% no-repeat; }
.p-item.active svg, .p-item.active small { color: #d8c6a6; }
.p-foot { display: flex; gap: var(--s4); padding: var(--s3) var(--s4) var(--s2); box-shadow: inset 0 1px 0 var(--line); color: var(--faint); font-size: var(--t13); }

/* ---------------------------------------------------------------- Notifications */
.toasts { zoom: var(--z, 1); position: fixed; z-index: 20; right: 4%; bottom: 6%; display: grid; gap: var(--s2); justify-items: end; }
.toast {
    position: relative;
    display: flex; align-items: center; gap: var(--s3);
    max-width: 400px; padding: var(--s4) var(--s5) var(--s4) var(--s5);
    background: none; text-shadow: var(--ts);
    font-size: var(--t16);
    animation: slide 200ms var(--ease);
}
.toast::after { content: ""; flex: 0 0 auto; order: -1; width: 4px; align-self: stretch; background: rgb(var(--red)); -webkit-mask: var(--tex-brush) center / 100% 100% no-repeat; }
.toast.err::after { background: rgb(var(--red)); filter: brightness(1.4); }
.toast.out { opacity: 0; transform: translateX(8px); transition: opacity 200ms, transform 200ms; }
@keyframes slide { from { opacity: 0; transform: translateX(12px); } }

/* ---------------------------------------------------------------- HUD (noclip / spectate) */
.hud {
    position: fixed; top: 5%; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: var(--s4);
    padding: var(--s3) var(--s5);
    background: none; text-shadow: var(--ts);
    font-size: var(--t14); color: var(--muted);
}
.hud b { color: #d8c6a6; font-family: var(--lino); font-weight: 400; font-size: var(--t16); }
.hud .dots { display: flex; gap: 3px; }
.hud .dots i { width: 7px; height: 7px; background: rgba(23, 45, 69, 0.4); box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.4); }
.hud .dots i.on { background: #d8c6a6; box-shadow: none; }

.clip { position: fixed; left: -9999px; top: 0; opacity: 0; }
.app.bg ~ #modal.copying:not(.hidden) { display: flex; }
.copy-text {
    max-height: 30vh; overflow: auto;
    font-family: var(--mono); font-size: var(--t14);
    white-space: pre-wrap; word-break: break-all;
    user-select: text;
}

/* ================================================================ V2 */
.muted { color: var(--faint); font-weight: 400; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: var(--s2); vertical-align: 1px; background: var(--faint); }
.dot.on { background: var(--ok); }
.dot.off { background: transparent; box-shadow: inset 0 0 0 1px var(--faint); }
.dot.wait { background: rgb(var(--red)); }
.link { padding: 0; border: 0; background: none; color: var(--text); text-decoration: underline; text-decoration-style: dotted; text-decoration-color: rgba(216, 198, 166, 0.5); text-underline-offset: 3px; cursor: pointer; }
.link:hover { text-decoration-style: solid; text-decoration-color: #d8c6a6; }

/* Segments (filtres) */
.seg { display: flex; gap: 2px; padding: 3px; margin-bottom: var(--s3); background: rgba(23, 45, 69, 0.32); box-shadow: inset 0 0 0 1px var(--line); }
.seg button {
    position: relative; isolation: isolate;
    flex: 1; height: 30px; padding-top: 2px; border: 0; background: transparent;
    font-family: var(--lino); font-size: var(--t14); line-height: 1;
    color: var(--muted); cursor: pointer; transition: color 120ms;
}
.seg button:hover { color: var(--text); }
.seg button.active { color: #d8c6a6; }
.seg button.active::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent); -webkit-mask: var(--tex-brush) center / 100% 100% no-repeat; }
.list-head .hint { margin-top: var(--s1); }

/* Fiche : onglets — trait de pinceau rouge sous l'onglet actif, comme les catégories de la sacoche */
.tabs { display: flex; gap: var(--s1); margin-bottom: var(--s4); box-shadow: inset 0 -1px 0 var(--line2); }
.tab {
    position: relative;
    display: flex; align-items: center; gap: 6px;
    height: 42px; padding: 2px var(--s3) 0; white-space: nowrap;
    border: 0; background: none;
    font-family: var(--lino); font-size: var(--t16); line-height: 1;
    color: var(--faint); cursor: pointer; transition: color 120ms;
}
.tab:hover { color: var(--text); }
.tab.active { color: #d8c6a6; }
.tab.active::after {
    content: ""; position: absolute; left: 2px; right: 2px; bottom: -2px; height: 6px;
    background: var(--accent); -webkit-mask: var(--tex-brush) center / 100% 100% no-repeat;
}
.tab kbd { display: none; }
.tab:hover kbd { display: inline-block; }
.tab .count { min-width: 18px; padding: 2px 5px 0; font-size: var(--t12); }

.stat.alert { background: var(--danger-dim); box-shadow: inset 0 0 0 1px rgba(var(--red), 0.9); }
.stat.alert b { color: #d8c6a6; }
.stat b .muted { font-size: var(--t13); font-family: var(--font); font-style: italic; }

.banner {
    display: flex; align-items: center; gap: var(--s3);
    margin-bottom: var(--s4); padding: var(--s3) var(--s4);
    background: var(--danger-dim); box-shadow: inset 3px 0 0 rgb(var(--red)), inset 0 0 0 1px rgba(var(--red), 0.6);
    color: var(--text); font-size: var(--t14);
}
.banner svg { color: #d8c6a6; }
.banner span { flex: 1; }

/* Sanctions */
.s-item { display: grid; grid-template-columns: 120px 1fr auto; gap: var(--s3); align-items: center; padding: var(--s3); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
.s-item.revoked { opacity: 0.5; }
.s-item.revoked .s-body > div { text-decoration: line-through; text-decoration-color: var(--faint); }
.s-type { font-family: var(--lino); font-size: var(--t16); font-weight: 400; letter-spacing: 0.03em; color: var(--muted); }
.s-type.t-ban { color: var(--danger); }
.s-type.t-warn { color: var(--warn); }
.s-body { min-width: 0; line-height: 1.4; }
.s-body small { color: var(--faint); font-style: italic; font-size: var(--t13); }
.s-side { display: flex; align-items: center; gap: var(--s2); }
.history { gap: var(--s2); }

/* Notes : papier épinglé, filet blanc à gauche */
.n-item { padding: var(--s3) var(--s4); background: var(--raise); box-shadow: inset 3px 0 0 rgba(216, 198, 166, 0.8), inset 0 0 0 1px var(--line); }
.n-text { font-size: var(--t16); line-height: 1.45; white-space: pre-wrap; user-select: text; }
.n-foot { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s2); }
.n-foot small { color: var(--faint); font-style: italic; font-size: var(--t13); }

/* Personnages */
.card.char + .card.char { margin-top: 0; }
.c-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.c-head h3 { flex: 1; margin: 0; }
.kv2 { display: grid; grid-template-columns: 74px 1fr; gap: 6px var(--s3); font-size: var(--t14); }
.kv2 span { color: var(--faint); font-family: var(--lino); }
.kv2 b { font-weight: 400; }

/* Fiche : XP (métiers, aptitudes) */
.xp-head { align-items: center; margin: var(--s3) 0; }
.xp-head .hint { flex: 1; display: flex; align-items: center; gap: var(--s2); }
.xp-list { display: grid; gap: 2px; }
.xp-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 6px var(--s3); padding: var(--s2) var(--s3); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
.xp-name { display: grid; min-width: 0; }
.xp-name b { font-weight: 400; font-family: var(--lino); }
.xp-name small { color: var(--faint); font-style: italic; font-size: var(--t13); font-variant-numeric: tabular-nums; }
.xp-lvl { display: flex; align-items: center; gap: var(--s1); }
.xp-lvl span { min-width: 64px; text-align: center; font-family: var(--lino); font-variant-numeric: tabular-nums; }
.xp-lvl span b { font-weight: 400; font-size: var(--t16); color: #d8c6a6; }
.xp-lvl span small { color: var(--faint); font-size: var(--t13); }
.xp-lvl .btn, .xp-acts .btn.ghost { width: 32px; padding: 0; justify-content: center; }
.xp-acts { display: flex; gap: var(--s1); }
.xp-bar { grid-column: 1 / -1; height: 3px; background: rgba(216, 198, 166, 0.06); position: relative; }
.xp-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); }

.h-item.clickable { width: 100%; border: 0; color: inherit; text-align: left; cursor: pointer; }
.h-item.clickable:hover { background: var(--hover); box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.5); }

/* Tickets */
.trow .who b { display: flex; align-items: center; gap: var(--s2); }
.unread { width: 8px; height: 8px; background: rgb(var(--red)); box-shadow: 0 0 0 1.5px #d8c6a6; flex-shrink: 0; }
.thread-col { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.t-head { display: grid; gap: var(--s3); padding: var(--s5) var(--s5) var(--s4); box-shadow: inset 0 -1px 0 var(--line); }
.t-head h2 { font-family: var(--lino); font-size: var(--t24); font-weight: 400; line-height: 1.1; filter: url(#rvInk); }
.t-head p { margin-top: var(--s1); color: var(--muted); font-style: italic; font-size: var(--t14); }
.t-acts { display: flex; flex-wrap: wrap; gap: var(--s2); }
.t-acts .danger { margin-left: auto; }
.btn.ghost.danger { color: var(--danger); }
.thread { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5); }
.msg { display: flex; flex-direction: column; max-width: 72%; }
.msg .bubble { padding: var(--s2) var(--s4); font-size: var(--t16); line-height: 1.4; white-space: pre-wrap; user-select: text; }
.msg small { margin-top: var(--s1); color: var(--faint); font-style: italic; font-size: var(--t13); }
.msg.player { align-self: flex-start; }
.msg.player .bubble { background: var(--well); box-shadow: inset 2px 0 0 rgba(216, 198, 166, 0.7), inset 0 0 0 1px var(--line); }
.msg.staff { align-self: flex-end; align-items: flex-end; }
.msg.staff .bubble { background: var(--accent-dim); box-shadow: inset -2px 0 0 rgb(var(--red)), inset 0 0 0 1px rgba(var(--red), 0.6); }
.composer { display: grid; gap: var(--s3); padding: 0 var(--s5) var(--s4); background: rgba(23, 45, 69, 0.15); }
.composer::before { margin: 0 calc(-1 * var(--s3)); opacity: 0.5; }
.composer .chip { height: 28px; font-size: var(--t13); }
.c-row { display: grid; grid-template-columns: 1fr auto; gap: var(--s2); align-items: end; }
.c-row textarea.field { min-height: 64px; max-height: 160px; }

/* ================================================================ V3 */
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.card-head h3 { display: flex; align-items: center; gap: var(--s2); margin: 0; }
.card-head h3 svg { color: #d8c6a6; }
.card > .card-head + p { margin-top: calc(-1 * var(--s1)); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.wchips .chip { height: 28px; padding: 2px 10px 0; font-size: var(--t13); }
.opt { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: var(--s3); }
.opt > span { color: var(--muted); font-family: var(--lino); font-size: var(--t14); }
.hm { display: flex; align-items: center; gap: var(--s2); }
.hm .field { width: 72px; text-align: center; }
.hm b { color: var(--faint); }
.stats.s4 { grid-template-columns: repeat(4, 1fr); }
.grid2 > .card { margin-top: 0; }
.toggle small kbd { margin: 0 1px; }

/* HUD : panneau du viseur, à droite, hors du centre de l'écran */
.hud.panel-mode {
    top: 50%; left: auto; right: 4%; transform: translateY(-50%);
    display: block; padding: var(--s1);
}
.hud.panel-mode::before { -webkit-mask-box-image: var(--tex-panel) 40 / 22px stretch; }
.insp { width: 310px; padding: var(--s4) var(--s5); }
.insp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s3); }
.insp .kv2 { grid-template-columns: 72px 1fr; }
.insp .kv2 b { color: var(--text); font-variant-numeric: tabular-nums; word-break: break-all; }
.insp-keys { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s3); padding-top: var(--s3); box-shadow: inset 0 1px 0 var(--line2); }

/* ================================================================ V4 */
body.no-motion *, body.no-motion *::before, body.no-motion *::after { animation: none !important; transition: none !important; }

/* Petits écrans ou interface agrandie : les stats passent à la ligne, les onglets défilent */
.stats, .stats.s4 { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
.stat b { white-space: nowrap; }
.tabs { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex-shrink: 0; }
.side-foot .nav-item { height: 36px; margin: 0 calc(-1 * var(--s2)) var(--s1); padding: 0 var(--s3); font-size: var(--t14); }
.side-foot .nav-item svg { width: 15px; height: 15px; }

/* Palette : groupes et favoris */
.p-group { padding: var(--s3) var(--s3) var(--s1); margin: 0; font-size: var(--t13); color: var(--faint); }
.p-fav { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; background: none; color: var(--faint); cursor: pointer; opacity: 0; transition: opacity 120ms, color 120ms; }
.p-item:hover .p-fav, .p-item.active .p-fav, .p-fav.on { opacity: 1; }
.p-fav:hover { color: var(--text); background: var(--hover); }
.p-fav.on { color: var(--warn); }
.p-item.active .p-fav.on { color: #d8c6a6; }
.p-fav svg, .p-item .p-fav svg, .p-item.active .p-fav svg { width: 14px; height: 14px; color: inherit; }

/* Éditeur de permissions */
.perm-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); }
.perm-sum { color: var(--muted); font-style: italic; white-space: nowrap; }
.perm-sum b { color: var(--text); font-family: var(--lino); font-style: normal; font-weight: 400; font-size: var(--t20); }
.perm-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); }
.toggle.compact { width: auto; min-height: 52px; gap: var(--s4); }
.perm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
.perm-grid > .card + .card { margin-top: 0; }
.perm-group .card-head { margin-bottom: var(--s2); }
.check {
    display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: var(--s3);
    width: 100%; min-height: 34px; padding: 0 var(--s2); border: 0;
    background: none; text-align: left; color: var(--muted); cursor: pointer; transition: background 120ms, color 120ms;
}
.check:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.check:disabled { cursor: default; opacity: 0.6; }
.check .box { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; background: rgba(23, 45, 69, 0.35); box-shadow: inset 0 0 0 1.5px rgba(216, 198, 166, 0.55); }
.check .box svg { width: 12px; height: 12px; stroke-width: 3; opacity: 0; filter: none; }
.check.on { color: var(--text); }
.check.on .box { background: var(--accent); box-shadow: inset 0 0 0 1.5px rgba(216, 198, 166, 0.8); color: #d8c6a6; }
.check.on .box svg { opacity: 1; }
.check code { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.banner.info { background: var(--well); box-shadow: inset 3px 0 0 rgba(216, 198, 166, 0.7), inset 0 0 0 1px var(--line); }
.banner.info svg { color: var(--muted); }

/* Navigateur d'animations */
.view.fill { display: flex; flex-direction: column; overflow: hidden; }
.ab-bar { display: flex; gap: var(--s2); margin-bottom: var(--s3); flex-shrink: 0; }
.ab-bar .search-field { flex: 1; }
.ab-bar .seg { margin: 0; width: 290px; }
.ab-filters { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s4); margin-bottom: var(--s3); flex-shrink: 0; }
.ab-filters .chip { height: 28px; padding: 2px 10px 0; font-size: var(--t13); }
.ab-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.ab-col { display: flex; flex-direction: column; min-height: 0; background: var(--well); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.ab-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 40px; padding: var(--s2) var(--s3); box-shadow: inset 0 -1px 0 var(--line); color: var(--muted); font-family: var(--lino); font-size: var(--t14); }
.ab-head code { font-family: var(--mono); font-size: var(--t12); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: text; }
.ab-col .list { flex: 1; overflow: auto; padding: var(--s1); }
.ab-row { grid-template-columns: 1fr auto; min-height: 34px; padding: var(--s1) var(--s3); }
.ab-row .who b { font-weight: 400; font-family: var(--mono); font-size: var(--t12); }
.ab-item { display: grid; grid-template-columns: 18px 1fr auto 20px; align-items: center; gap: var(--s2); min-height: 32px; padding: 0 var(--s3); cursor: pointer; }
.ab-item:hover { background: var(--hover); }
.ab-item.active { background: rgba(216, 198, 166, 0.12); box-shadow: inset 3px 0 0 var(--accent); }
.ab-item.hit .ab-name { color: var(--warn); }
.ab-name { font-family: var(--mono); font-size: var(--t12); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-name i { font-family: var(--font); color: var(--muted); }
.ab-mark { font-family: var(--lino); font-size: var(--t14); text-align: center; }
.ab-mark.ok { color: var(--ok); }
.ab-mark.ko { color: var(--danger); }
.ab-play { color: var(--faint); opacity: 0; }
.ab-item:hover .ab-play, .ab-item.active .ab-play { opacity: 1; color: #d8c6a6; }
.ab-item .p-fav { opacity: 0; }
.ab-item:hover .p-fav, .ab-item.active .p-fav, .ab-item .p-fav.on { opacity: 1; }
.ab-foot { display: flex; flex-wrap: wrap; gap: var(--s3); padding: var(--s2) var(--s3); box-shadow: inset 0 1px 0 var(--line); color: var(--faint); font-size: var(--t13); }

/* Fenêtre joueur (/report) */
.pt-panel { width: min(580px, 92vw); height: auto; max-height: 84vh; display: flex; flex-direction: column; }
.pt-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: var(--s4) var(--s5); }
.pt-head::after { content: ""; position: absolute; left: var(--s3); right: var(--s3); bottom: 0; height: 2px; background: rgba(216, 198, 166, 0.75); -webkit-mask: var(--tex-rule) center / 100% 100% no-repeat; }
.pt-head h2 { font-family: var(--lino); font-size: var(--t24); font-weight: 400; line-height: 1.1; filter: url(#rvInk); }
.pt-body { display: flex; flex-direction: column; gap: var(--s4); min-height: 0; padding: var(--s5); }
.pt-intro { color: var(--muted); font-style: italic; font-size: var(--t16); line-height: 1.45; }
.pt-status { color: var(--muted); font-size: var(--t14); }
.pt-status b { color: var(--text); font-family: var(--lino); font-weight: 400; }
.pt-thread { max-height: 44vh; padding: var(--s3); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
.pt-foot { display: flex; justify-content: space-between; gap: var(--s2); }
.pt-foot:only-child, .pt-body > .pt-foot:last-child { margin-top: var(--s1); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Fenêtres déplaçables : on les attrape par l'en-tête */
.panel { position: relative; }
.top, .brand, .pt-head { cursor: grab; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none !important; }

/* Navigateur de PNJ */
.ab-cols.one { grid-template-columns: 1fr; }
.pb-item { grid-template-columns: 1fr auto auto auto 20px; }
.pb-cat { color: var(--faint); font-style: italic; font-size: var(--t13); }
.ab-filters .chips { flex-wrap: wrap; }

/* Menu en arrière-plan (Alt) : visible, mais le jeu a la main */
.app.bg { background: none; pointer-events: none; }
.app.bg .panel { opacity: 0.5; }
.app.bg ~ .overlay { display: none; }
.app.bg::after {
    content: "Arrière-plan · Alt pour reprendre la main";
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    padding: 5px 12px 3px;
    background: #d8c6a6; color: rgb(var(--scrim));
    font-family: var(--lino); font-size: var(--t14);
    box-shadow: 1px 1px 0 var(--shade);
}

/* ================================================================ Fenêtre redimensionnable */
.seg { max-width: 100%; }
.rz { position: absolute; z-index: 4; }
.rz-l, .rz-r { top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.rz-t, .rz-b { left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.rz-l { left: 0; } .rz-r { right: 0; } .rz-t { top: 0; } .rz-b { bottom: 0; }
.rz-tl, .rz-tr, .rz-bl, .rz-br { width: 24px; height: 24px; z-index: 5; }
.rz-tl { left: 0; top: 0; cursor: nwse-resize; }
.rz-br { right: 0; bottom: 0; cursor: nwse-resize; }
.rz-tr { right: 0; top: 0; cursor: nesw-resize; }
.rz-bl { left: 0; bottom: 0; cursor: nesw-resize; }
/* Petite poignée visible dans le coin bas-droit */
.rz-br::after {
    content: ""; position: absolute; right: 12px; bottom: 12px; width: 9px; height: 9px;
    border-right: 2px solid rgba(216, 198, 166, 0.4); border-bottom: 2px solid rgba(216, 198, 166, 0.4);
    transition: border-color 120ms;
}
.rz-br:hover::after, body.resizing .rz-br::after { border-color: #d8c6a6; }
.app.bg .rz { display: none; }
/* Menu en pause après une action (TP, spectate…) : caché sans rien perdre, Alt le fait revenir */
.app.bg.away .panel { visibility: hidden; }
.app.bg.away::after { content: "Menu en pause · Alt pour le reprendre"; }

/* Ticket joueur en arrière-plan : plus lisible que le menu admin (il suit la discussion en jouant) */
.pt-tools { display: flex; gap: var(--s1); }
#pt.bg .panel { opacity: 0.82; }
#pt.bg .pt-tools, #pt.bg .pt-foot, #pt.bg .c-row { display: none; }
#pt.bg::after { content: "Ticket en arrière-plan · Alt ou /report pour répondre"; }
body.resizing, body.resizing * { user-select: none !important; }
body.resizing[data-rz="l"] *, body.resizing[data-rz="r"] * { cursor: ew-resize !important; }
body.resizing[data-rz="t"] *, body.resizing[data-rz="b"] * { cursor: ns-resize !important; }
body.resizing[data-rz="tl"] *, body.resizing[data-rz="br"] * { cursor: nwse-resize !important; }
body.resizing[data-rz="tr"] *, body.resizing[data-rz="bl"] * { cursor: nesw-resize !important; }

/* --- Moyenne (< 1000 px) : barre latérale réduite aux icônes */
.panel.sz-m { grid-template-columns: 68px 1fr; }
.sz-m .side { padding: var(--s4) var(--s2) var(--s3); }
.sz-m .brand { justify-content: center; padding: 0 0 var(--s4); }
.sz-m .logo { display: block; width: calc(1ch + 18px); padding: 5px 9px 2px; overflow: hidden; white-space: nowrap; }
.sz-m .role { display: none; }
.sz-m .nav { align-items: stretch; }
.sz-m .nav-item { position: relative; justify-content: center; padding: 0; }
.sz-m .nav-item::before { inset: 2px 0; }
.sz-m .nav-item > span:not(.count) { display: none; }
.sz-m .nav-item svg { width: 18px; height: 18px; }
.sz-m .nav .count { position: absolute; top: 2px; right: 3px; min-width: 16px; padding: 2px 3px 0; font-size: 11px; line-height: 13px; }
.sz-m .side-foot { padding: 0; }
.sz-m .side-foot .nav-item { margin: 0; padding: 0; }
.sz-m .side-foot .keys { display: none; }
.sz-m .search-btn { width: 240px; }

/* --- Petite (< 820 px) : une colonne pour les cartes, liste plus étroite, marges réduites */
.sz-s .top { gap: var(--s3); padding: 6px var(--s4) 0; }
.sz-s .view { padding: var(--s4); }
.sz-s .view.split { grid-template-columns: 240px 1fr; padding: 0; }
.sz-s .detail { padding: var(--s4); }
.sz-s .search-btn { width: auto; }
.sz-s .search-btn span { display: none; }
.sz-s .grid2, .sz-s .perm-grid { grid-template-columns: 1fr; }
.sz-s .grid2 > .card + .card { margin-top: 0; }
.sz-s .grid3, .sz-s .actions.c4 { grid-template-columns: repeat(2, 1fr); }
.sz-s .ab-bar .seg { width: 220px; }
.sz-s .t-head { padding: var(--s4); }
.sz-s .thread { padding: var(--s4); }
.sz-s .composer { padding: 0 var(--s4) var(--s3); }

/* --- Très petite (< 680 px) */
.sz-xs .top h1 { font-size: var(--t20); }
.sz-xs .actions { grid-template-columns: repeat(2, 1fr); }
.sz-xs .form .row2, .sz-xs .form .row3 { grid-template-columns: 1fr; }
.sz-xs .d-head { flex-direction: column; gap: var(--s2); }
.sz-xs .d-tags { justify-content: flex-start; }
.sz-xs .s-item { grid-template-columns: 1fr auto; }
.sz-xs .s-type { grid-column: 1 / -1; }
.sz-xs .msg { max-width: 90%; }
.sz-xs .ab-cols { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.sz-xs .ab-foot { display: none; }
.sz-xs .perm-head, .sz-xs .perm-bar { flex-wrap: wrap; }

/* --- Peu de hauteur (< 560 px) */
.sz-short .top { height: 54px; }
.sz-short .brand { padding-bottom: var(--s3); }
.sz-short .nav-item { height: 34px; }
.sz-short .side-foot .keys { display: none; }
.sz-short .view { padding-top: var(--s3); padding-bottom: var(--s3); }

/* Listes étroites : les badges passent sous le nom au lieu de le couper */
.sz-s .list-col .row { grid-template-columns: 26px 1fr; row-gap: 2px; }
.sz-s .list-col .row .meta { grid-column: 2; flex-wrap: wrap; }
.sz-s .list-col .row .pid { align-self: start; padding-top: 2px; }
.sz-s .list-head { padding: var(--s3); }
.sz-s .seg button { padding: 2px 6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Peu de place : les filtres tiennent sur une ligne qui défile, la liste garde de la hauteur */
.sz-xs .ab-filters .chips, .sz-short .ab-filters .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.sz-xs .ab-filters .chips::-webkit-scrollbar, .sz-short .ab-filters .chips::-webkit-scrollbar { display: none; }
.sz-xs .ab-filters .chip, .sz-short .ab-filters .chip { flex-shrink: 0; }
.sz-short .ab-bar, .sz-short .ab-filters { margin-bottom: var(--s2); }

/* La barre latérale défile si la fenêtre est basse ; Préférences reste en bas */
.side { min-height: 0; }
.nav { min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }

/* Très petite : une seule ligne pour la recherche + options, segments compacts */
.sz-xs .ab-bar { flex-wrap: nowrap; }
.sz-xs .ab-bar .search-field { flex: 1; flex-basis: auto; min-width: 0; }
.sz-xs .ab-bar .seg { flex: 0 0 auto; width: 150px; }
.sz-xs .ab-bar .btn { width: 40px; padding: 0; font-size: 0; gap: 0; }
.sz-xs .ab-bar .btn svg { width: 16px; height: 16px; margin: 0; }
.sz-xs .seg button { padding: 2px 4px 0; font-size: var(--t12); }
.sz-xs .view.split { grid-template-columns: 210px 1fr; }

/* Tableaux : en-têtes sur une ligne, défilement horizontal si besoin */
.sz-s .table th { white-space: nowrap; }
.sz-s .table th, .sz-s .table td { padding: var(--s2); }
.sz-xs .ab-cols.one { grid-template-rows: 1fr; }

/* ================================================================ V5 : carte, objets, écurie, capture */
.txt-warn { color: var(--warn); }
.txt-danger { color: var(--danger); }
.mono, code.mono { font-family: var(--mono); font-size: var(--t12); user-select: text; }
.stat b { display: block; overflow: hidden; text-overflow: ellipsis; }
.c-acts { margin-top: var(--s3); }
.card.ride .c-head > svg { color: var(--muted); }
.card.anomaly > p { margin-bottom: var(--s2); }
.card.anomaly .table td { padding: 6px var(--s2); }

/* Capture d'écran */
.dialog.shot-dialog { width: min(1100px, calc(94vw / var(--z, 1))); }
.dialog.shot-dialog .body { padding-top: var(--s3); }
.shot { display: block; width: 100%; max-height: calc(62vh / var(--z, 1)); object-fit: contain; background: #000; box-shadow: inset 0 0 0 1px var(--line2); }

/* Carte : liste à gauche, carte à droite */
.view.map-view { display: grid; grid-template-columns: 260px 1fr; padding: 0; overflow: hidden; }
.map-side { display: flex; flex-direction: column; min-height: 0; padding: var(--s3) var(--s2) var(--s2); box-shadow: inset -1px 0 0 var(--line); }
.map-side .search-field { margin: 0 var(--s1); }
.map-side .list { flex: 1; overflow: auto; padding: var(--s2) 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: var(--s2) var(--s2) 0; box-shadow: inset 0 1px 0 var(--line); color: var(--faint); font-size: var(--t13); }
.lg { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; border-radius: 50%; background: #d8c6a6; box-shadow: 0 0 0 1.5px rgb(var(--scrim)); }
.lg.staff { background: var(--accent); box-shadow: 0 0 0 1.5px #d8c6a6; }
.lg.dead { background: rgba(216, 198, 166, 0.3); }
.lg.loc { border-radius: 0; background: transparent; box-shadow: inset 0 0 0 2px #d8c6a6; transform: rotate(45deg) scale(0.75); }

/* fond = couleur du parchemin des tuiles (après le filtre ci-dessous) : pas de cassure au-delà des bords */
.map { position: relative; overflow: hidden; background: rgb(192, 169, 138); cursor: grab; text-shadow: none; }
.map.grabbing { cursor: grabbing; }
.map-tiles, .map-marks { position: absolute; inset: 0; }
.map-tiles { filter: saturate(0.85) brightness(0.92); }
.map-marks { pointer-events: none; }
/* « map-tile » et non « tile » : .btn.tile est déjà le bouton-tuile du menu */
.map-tile { position: absolute; left: 0; top: 0; width: 256px; height: 256px; opacity: 0; transition: opacity 200ms; user-select: none; }
.map-tile.ok { opacity: 1; }

/* Repères : point blanc avec la direction du regard, staff en rouge Borderless */
.mk, .mk-loc { position: absolute; left: 0; top: 0; width: 0; height: 0; padding: 0; border: 0; background: none; pointer-events: auto; cursor: pointer; }
.mk i { position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; border-radius: 50%; background: #d8c6a6; box-shadow: 0 0 0 2px rgb(var(--scrim)), 0 1px 4px rgba(23, 45, 69, 0.7); }
.mk i::after { content: ""; position: absolute; left: 50%; top: -7px; transform: translateX(-50%); border: 4px solid transparent; border-top: 0; border-bottom: 6px solid #d8c6a6; filter: drop-shadow(0 -1px 0 rgb(var(--scrim))); }
.mk.staff i { background: var(--accent); box-shadow: 0 0 0 2px #d8c6a6, 0 1px 4px rgba(23, 45, 69, 0.7); }
.mk.staff i::after { border-bottom-color: #d8c6a6; }
.mk.dead i { background: rgba(216, 198, 166, 0.3); }
.mk.me i { box-shadow: 0 0 0 2px rgb(var(--scrim)), 0 0 0 5px rgba(216, 198, 166, 0.45), 0 1px 4px rgba(23, 45, 69, 0.7); }
.mk.sel i::before { content: ""; position: absolute; inset: -7px; border: 2px solid #d8c6a6; border-radius: 50%; box-shadow: 0 0 0 1.5px rgb(var(--scrim)); }
.mk.dim { opacity: 0.35; }
.mk span, .mk-loc span {
    position: absolute; left: 13px; top: -9px; white-space: nowrap; pointer-events: none;
    font-family: var(--lino); font-size: var(--t14); line-height: 1; color: #d8c6a6;
    text-shadow: 1px 1px 0 var(--shade), 0 0 4px rgba(23, 45, 69, 0.9);
}
.mk:hover span { text-decoration: underline; }
.mk-loc i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; transform: rotate(45deg); box-shadow: inset 0 0 0 2px #d8c6a6, 0 0 0 1.5px rgb(var(--scrim)); }
.mk-loc span { left: 10px; top: -8px; font-family: var(--font); font-style: italic; font-size: var(--t13); color: rgba(216, 198, 166, 0.85); }
.mk-loc:hover i { background: #d8c6a6; }
.mk-loc.spot i, .lg.loc.spot { background: var(--accent); }
.mk-loc.spot:hover i { background: #d8c6a6; }
.mk-train { position: absolute; left: 0; top: 0; width: 0; height: 0; padding: 0; border: 0; background: none; pointer-events: auto; cursor: default; }
.mk-train i { position: absolute; left: -7px; top: -5px; width: 14px; height: 10px; border-radius: 2px; background: rgba(23, 45, 69, 0.55); box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 1.5px #d8c6a6; }
.mk-train.real i { background: var(--accent); }
.mk-train.approx i { opacity: 0.6; box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 1.5px rgba(216, 198, 166, 0.6); }
.mk-train span { position: absolute; left: 11px; top: -9px; white-space: nowrap; font-size: var(--t13); color: #d8c6a6; text-shadow: 0 1px 2px rgb(var(--scrim)), 0 0 4px rgb(var(--scrim)); pointer-events: none; }
.lg.train { border-radius: 2px; width: 12px; height: 8px; background: var(--accent); box-shadow: 0 0 0 1.5px #d8c6a6; }
.lg.train.paper { background: transparent; box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 1.5px #d8c6a6; }
.map-sub { padding: var(--s2) var(--s2) 4px; color: var(--faint); font-size: var(--t13); text-transform: uppercase; letter-spacing: 0.06em; }

/* Bulle d'un joueur / d'un point */
.map-pop { position: absolute; left: 0; top: 0; z-index: 3; width: 0; height: 0; }
.pop-body {
    position: absolute; left: 16px; top: 16px; display: grid; gap: 3px; width: 330px; padding: var(--s3) var(--s4);
    background: rgba(var(--scrim), 0.95); box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px var(--line2), var(--shadow);
    text-shadow: var(--ts); cursor: default;
}
.pop-body b { font-family: var(--lino); font-weight: 400; font-size: var(--t16); }
.pop-body small { color: var(--muted); font-style: italic; }
.pop-body small.mono { font-style: normal; color: var(--faint); }
.pop-body .btn-row { margin-top: var(--s2); }
.map-pop.flip .pop-body { left: auto; right: 16px; }
.map-pop.up .pop-body { top: auto; bottom: 16px; }

.map-ctl { position: absolute; right: var(--s3); top: var(--s3); display: grid; gap: 6px; z-index: 2; }
.map-ctl .btn { width: 36px; height: 36px; padding: 0; background: rgba(var(--scrim), 0.88); }
.map-ctl .btn svg { margin: 0; }
.map-note {
    position: absolute; left: 50%; top: var(--s4); z-index: 2; transform: translateX(-50%);
    display: flex; align-items: center; gap: var(--s2); max-width: 70%; padding: var(--s2) var(--s4);
    background: rgba(var(--scrim), 0.94); box-shadow: inset 3px 0 0 rgb(var(--red)), inset 0 0 0 1px var(--line2);
    font-size: var(--t14); text-shadow: var(--ts);
}
.map-note svg { color: var(--warn); }
.map-foot {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; gap: var(--s4);
    padding: var(--s4) var(--s3) 6px; pointer-events: none;
    background: linear-gradient(0deg, rgba(var(--scrim), 0.88), transparent);
    color: var(--muted); font-size: var(--t13); text-shadow: var(--ts);
}
.map-foot #mapzoom, .map-foot #mapcoords { font-family: var(--lino); }
.map-foot .hint { margin-left: auto; }
.sz-m .view.map-view { grid-template-columns: 220px 1fr; }
.sz-s .view.map-view { grid-template-columns: 1fr; }
.sz-s .map-side { display: none; }
.sz-s .map-foot .hint { display: none; }
.section .card h3 { margin-bottom: 0; color: var(--text); font-size: var(--t20); letter-spacing: 0; }
.section .card h3::after { content: none; }
.badge { white-space: nowrap; }
.map-side .row { grid-template-columns: 26px 1fr; row-gap: 2px; }
.map-side .row .meta { grid-column: 2; }
.map-side .row .meta:empty { display: none; }
.mk-loc span { opacity: 0; transition: opacity 120ms; }
.mk-loc:hover span { opacity: 1; }

/* Fiche : 7 onglets, tous visibles (deux lignes plutôt qu'un onglet caché hors de la barre) */
.view.split { grid-template-columns: 300px 1fr; }
.tabs { gap: 0; flex-wrap: wrap; overflow: visible; }
.tab { padding: 2px 8px 0; font-size: var(--t14); }
.tab .count { padding: 2px 4px 0; }

/* Liste des joueurs : le nom garde toute la largeur, badges et ping passent dessous */
.list-col .row { grid-template-columns: 30px 1fr; row-gap: 3px; }
.list-col .row .meta { grid-column: 2; flex-wrap: wrap; }
.list-col .row .pid { align-self: start; padding-top: 3px; }

/* ---------------------------------------------------------------- Panel web hors jeu (web.js) */
body.web {
    background: radial-gradient(ellipse at 50% 35%, rgba(var(--red), 0.28), rgba(var(--scrim), 1) 70%) #172d45;
    user-select: text;
}
body.web .app { background: none; }
.weblogin { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; animation: fade 180ms var(--ease); }
.wl-card {
    width: min(380px, 100%);
    display: grid; justify-items: center; gap: var(--s3);
    padding: var(--s6, 28px) var(--s5);
    background: rgba(var(--scrim), var(--alpha));
    box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
    text-align: center; text-shadow: var(--ts);
}
.wl-logo { font-size: 34px; }
.wl-sub { font-family: var(--lino); font-size: var(--t18, 18px); color: var(--muted); }
.wl-err { min-height: 1.3em; color: #d8c6a6; font-style: italic; }
.wl-err:empty { display: none; }
.wl-btn { width: 100%; text-decoration: none; }
.wl-note { font-size: var(--t12); color: var(--faint); }

/* Onglet Combat de la fiche : silhouette des zones touchées, barres, historique des morts */
.cb-zones { display: grid; grid-template-columns: 96px 1fr; gap: var(--s4); align-items: center; }
.cb-body { width: 96px; height: auto; }
.cb-body > * { stroke: rgba(216, 198, 166, 0.5); stroke-width: 1; }
.cb-bars { display: grid; gap: var(--s3); }
.cb-bar { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s2); font-size: var(--t14); }
.cb-bar span { font-family: var(--lino); }
.cb-bar b { font-family: var(--lino); font-weight: 400; font-variant-numeric: tabular-nums; }
.cb-bar i { grid-column: 1 / -1; height: 4px; background: var(--well); box-shadow: inset 0 0 0 1px var(--line); position: relative; }
.cb-bar i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); }
.cb-bar small { grid-column: 1 / -1; color: var(--faint); font-style: italic; }
.cb-item { grid-template-columns: 110px 1fr auto; align-items: center; }
.cb-item .hint { margin-top: 2px; }
.cb-side { display: grid; justify-items: end; gap: 2px; font-size: var(--t13); }
.cb-side small { color: var(--faint); font-style: italic; }
.cb-item.clickable:focus-visible { outline: 1px solid #d8c6a6; outline-offset: -1px; }
.cb-body .final { stroke: #d8c6a6; stroke-width: 2.5; }
.cb-hit { grid-template-columns: 110px 1fr; margin-bottom: var(--s4); padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.cb-hit .cb-body { width: 110px; }
.cb-hit .hint { margin: 0; }
.cb-bar em { font-style: italic; font-family: var(--font); font-size: var(--t12); color: #d8c6a6; margin-left: var(--s2); }
.cb-bar.final b { color: #d8c6a6; }
.cb-detail { display: grid; grid-template-columns: 110px 1fr; gap: var(--s2) var(--s3); align-items: baseline; font-size: var(--t14); }
.cb-detail > span { color: var(--faint); font-family: var(--lino); }
.cb-detail code { font-family: var(--mono); font-size: var(--t12); color: var(--muted); user-select: text; }

/* ------------------------------------------------------------------ Portes */
.door-lieux { margin: var(--s3) 0 var(--s4); }
.door-lieux .chip { height: 28px; padding: 2px 10px 0; font-size: var(--t13); }
.door-lieu { margin: var(--s5) 0 var(--s2); font-family: var(--lino); font-size: var(--t20); font-weight: 400; }
.door-bat { padding: 0; margin-bottom: var(--s2); }
.door-bat + .door-bat { margin-top: 0; }
.door-bat-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); cursor: pointer; }
.door-bat-head:hover { background: rgba(216, 198, 166, 0.04); }
.door-bat-head:focus-visible { outline: 1.5px solid #d8c6a6; outline-offset: -2px; }
.door-bat.open .door-bat-head { border-bottom: 1px solid var(--line); }
.door-bat-act { padding: var(--s3) var(--s4) 0; }
.door-bat .table { margin: var(--s2) 0 var(--s2); }
.door-sub { color: var(--faint); font-size: var(--t13); margin-top: 2px; }
.door-name { font-weight: 500; }
.door-help { margin-top: var(--s5); }

/* Tripots : liste en cartes, fiche en onglets, éditeur de PNJ */
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s4); }
.tp-grid > .card + .card { margin-top: 0; }
.tp-card { cursor: pointer; transition: box-shadow .15s; }
.tp-card:hover, .tp-card:focus-visible { box-shadow: inset 0 0 0 1px rgba(216, 198, 166, 0.55); outline: none; }
.tp-card .card-head { flex-wrap: wrap; }
.tp-facts { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); color: var(--muted); font-size: var(--t14); }
.tp-facts b { color: var(--text); font-weight: 500; }
.tp-head { align-items: center; }
.tp-title { margin: 0 0 0 var(--s2); font-family: var(--lino); font-size: var(--t20); font-weight: 400; }
.tp-title .muted { font-family: var(--font); font-size: var(--t14); font-style: italic; }
.tp-pass { margin-bottom: var(--s3); font-family: var(--lino); font-size: var(--t20); letter-spacing: .04em; }
.tp-net { font-family: var(--lino); color: var(--muted); }
.tp-trust { min-width: 140px; }
.tp-trust i { display: inline-block; vertical-align: middle; width: 90px; height: 4px; margin-right: var(--s2); background: linear-gradient(90deg, var(--accent) var(--w), var(--line2) var(--w)); }
.tp-trust b { font-weight: 500; }
.tp-editor { display: grid; gap: var(--s4); }
.tp-editor > .card + .card { margin-top: 0; }
.tp-editor textarea.field { min-height: 64px; }
.tp-topic { display: grid; gap: var(--s2); padding: var(--s3); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
.tp-topic-head { display: grid; grid-template-columns: 1fr 110px auto; gap: var(--s3); align-items: end; }
.sz-s .tp-topic-head { grid-template-columns: 1fr 90px auto; }
.sz-s .tp-editor .row2, .sz-s .tp-editor .row3 { grid-template-columns: 1fr; }

/* ------------------------------------------------------------------ Entreprises (entreprises.js)
   Palette Borderless seulement : prête = pastille blanche, incomplète = rouge cerclée, archivée = creuse */
.ent-dot { display: inline-block; flex: none; width: 10px; height: 10px; margin-right: var(--s2); border-radius: 50%; vertical-align: 1px; }
.ent-dot.ok { background: #d8c6a6; }
.ent-dot.warn { background: var(--accent); box-shadow: 0 0 0 1.5px #d8c6a6; }
.ent-dot.off { box-shadow: inset 0 0 0 1.5px var(--faint); }
.ent-filters { align-items: center; flex-wrap: wrap; }
.ent-filters .chips { flex: 1; }
.ent-sum { display: inline-flex; align-items: center; gap: var(--s1); color: var(--muted); font-size: var(--t13); white-space: nowrap; }
.ent-sum .ent-dot { margin-left: var(--s2); margin-right: 2px; }
.ent-card.off { opacity: .55; }
.ent-misses { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s3); }
.ent-misses-head { align-items: center; margin: 0 0 var(--s4); }
.ent-miss { padding: 3px 9px 1px; border: 0; background: var(--accent-dim); color: #d8c6a6; font-family: var(--lino); font-size: var(--t13); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(var(--red), .9); }
.ent-miss:hover { background: var(--accent); }
.ent-miss.soft { background: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line2); }
.ent-owed { color: #d8c6a6; text-decoration: underline 1.5px rgb(var(--red)); text-underline-offset: 3px; }
.ent-grades td { vertical-align: top; padding-top: var(--s3); }
.ent-grades .field { width: 100%; min-width: 120px; }
.ent-grades .ent-wage { width: 80px; min-width: 0; }
.ent-rights { gap: var(--s1); }
.ent-rights .chip { height: 26px; padding: 2px 9px 0; font-size: var(--t12); }
.ent-radius { display: inline-flex; align-items: center; gap: var(--s2); }
.ent-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s3); margin-top: var(--s4); }
.ent-kind { display: grid; gap: var(--s2); align-content: start; padding: var(--s3); background: var(--raise); box-shadow: inset 0 0 0 1px var(--line); }
.ent-kind.need { box-shadow: inset 0 0 0 1px rgba(var(--red), .95); }
.ent-kind-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.ent-kind-head h4 { display: flex; align-items: center; gap: var(--s2); margin: 0; font-family: var(--lino); font-size: var(--t16); font-weight: 400; }
.ent-kind-head h4 svg { width: 16px; height: 16px; }
.ent-point { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1) var(--s2); padding: var(--s1) 0 var(--s1) var(--s2); border-top: 1px solid var(--line); }
.ent-point > span { flex: 1 1 150px; min-width: 0; }
.ent-point .btn-row { gap: var(--s1); }
.ent-balance { margin: var(--s2) 0 var(--s3); font-family: var(--lino); font-size: var(--t24); }
.ent-pick { display: grid; gap: 2px; max-height: 220px; overflow: auto; }
.ent-pick-row { padding: var(--s2) var(--s3); border: 0; background: var(--well); color: var(--text); text-align: left; font-family: var(--font); font-size: var(--t14); cursor: pointer; }
.ent-pick-row:hover { background: var(--hover); }
.ent-pick-row.on { background: var(--accent); }

/* Tripots : éditeur de missions */
.tp-steps { display: grid; gap: var(--s3); }
.tp-step { display: grid; gap: var(--s2); padding: var(--s3); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
.tp-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.tp-step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; background: var(--accent); color: #d8c6a6; font-family: var(--lino); font-weight: 400; }
.tp-step-head .chips { gap: 4px; }
.tp-step-head .chip { height: 28px; }
.tp-step > .hint { margin: 0; }
.tp-pos { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2); padding-bottom: 2px; }
.tp-pos .muted { font-size: var(--t14); align-self: center; }
.tp-items { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.tp-item { display: inline-flex; align-items: center; gap: var(--s2); padding: 2px 2px 2px var(--s3); background: var(--raise); box-shadow: inset 0 0 0 1px var(--line2); font-size: var(--t14); }
.tp-item .field { width: 64px; height: 28px; }

/* Tripots : réponses d'une étape « choix » (lot 4b) */
.tp-opts { display: grid; gap: var(--s2); }
.tp-opt { display: grid; gap: var(--s2); padding: var(--s3); background: var(--raise); box-shadow: inset 0 0 0 1px var(--line2); }
.tp-opt .tp-step-head b { font-size: var(--t14); }

/* trésors des villes (Entreprises) */
.ent-tresors { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: 0 0 var(--s4); }
.ent-tresors > .hint { width: 100%; }
.ent-tresor { display: inline-flex; align-items: center; gap: var(--s2); padding: 4px 6px 4px 10px; border: 1px solid rgba(216,198,166,.12); border-radius: 6px; background: rgba(23,45,69,.45); }
.ent-tresor b { font-variant-numeric: tabular-nums; }
.ent-tresor .btn.sm { padding: 2px 6px; }

