/* Justice Unanim RP (meme base que le panel) — palette de DESIGN_TOKENS.md (brun-noir chaud, accents orange / or).
   Regle : l'orange ne porte jamais de texte blanc ; sur fond orange, texte fonce. */

:root {
    --bg-900: #0d0806;
    --bg-850: #140c08;
    --bg-800: #1a100a;
    --bg-700: #2a1810;
    --line: #4a2a1c;
    --line-soft: rgba(255, 255, 255, 0.07);
    --orange: #ff8c00;
    --orange-400: #ffa733;
    --orange-700: #cc6600;
    --gold: #ffc107;
    --gold-300: #ffd966;
    --text: #ffffff;
    --text-2: #c7c7c7;
    --muted: #9a8f88;
    --ok: #3cb371;
    --warn: #ffc107;
    --err: #e63946;
    --info: #4fa3d1;
    --on-accent: #1a100a;
    --accent-soft: rgba(255, 140, 0, 0.13);

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Bebas Neue', 'Arial Narrow', Impact, sans-serif;
    --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --r: 8px;
    --r-card: 12px;
    --side-w: 240px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg-900); color: var(--text-2); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; color: var(--text); line-height: 1.2; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--r); background: var(--gold); color: var(--on-accent); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.ic { width: 18px; height: 18px; flex-shrink: 0; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
small { font-size: 12.5px; }

/* ------------------------------------------------------------ Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line);
    background: var(--bg-700); color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none;
    cursor: pointer; white-space: nowrap; transition: background-color 150ms, border-color 150ms, box-shadow 150ms, transform 120ms;
}
.btn:hover { border-color: var(--orange-700); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--gold), var(--orange)); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { box-shadow: 0 0 22px rgba(255, 140, 0, 0.35); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: rgba(230, 57, 70, 0.55); color: #ff8a93; }
.btn.danger:hover { background: rgba(230, 57, 70, 0.12); border-color: var(--err); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.discord { min-height: 50px; width: 100%; background: #5865f2; border-color: transparent; color: #fff; font-size: 15px; }
.btn.discord:hover { background: #4752c4; }
.btn.discord .ic { width: 22px; height: 22px; }
.icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r);
    border: 1px solid var(--line-soft); background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link { color: var(--orange-400); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.link:hover { text-decoration: underline; }

/* ------------------------------------------------------------ Structure */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
    padding: 18px 14px; background: var(--bg-850); border-right: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 8px; text-decoration: none; }
.brand img { height: 36px; width: auto; }
.brand span { font-family: var(--font-display); font-size: 26px; letter-spacing: 0.05em; color: var(--text); line-height: 1; }
.brand small { display: block; font-family: var(--font); font-size: 10.5px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--orange-400); margin-top: 3px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
    display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--r);
    color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14.5px; transition: background-color 150ms, color 150ms;
}
.side-nav a:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--orange); }
.side-nav a[aria-current="page"] .ic { color: var(--orange-400); }
.side-foot { margin-top: auto; }
.server-pill {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r);
    background: var(--bg-800); border: 1px solid var(--line-soft); text-decoration: none; font-size: 13px;
}
.server-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(60, 179, 113, 0.18); }
.server-pill b { color: var(--text); font-variant-numeric: tabular-nums; }
.server-pill.off i { background: var(--err); box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.18); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
    min-height: 72px; padding: 12px 28px; background: rgba(13, 8, 6, 0.94); border-bottom: 1px solid var(--line-soft);
}
.titles { min-width: 0; flex: 1; }
.titles h1 { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titles p { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip img { width: 36px; height: 36px; border-radius: 50%; }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip b { color: var(--text); font-size: 14px; }
.role { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.role::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--role, #99aab5); }
/* Largeur de lecture plafonnee et CENTREE : sur un ecran large, le contenu
   ne reste pas colle a gauche avec un vide a droite. Au-dela de 1900 px de
   large, le plafond monte et les marges s'elargissent (voir plus bas). */
.content { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 18px; max-width: 1440px; width: 100%; margin-inline: auto; }

/* ------------------------------------------------------------ Cartes */
.card { background: var(--bg-800); border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 18px 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card.flush .card-h { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.card-h h2 { display: flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 700; }
.card-h h2 .ic { color: var(--orange-400); }
.card-note { font-size: 12.5px; color: var(--muted); }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 9999px; background: var(--bg-700); color: var(--text-2); font-size: 12px; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.span-2 { grid-column: 1 / -1; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.col-main, .col-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.col-side { position: sticky; top: 90px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .ic { width: 16px; height: 16px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid rgba(255, 140, 0, 0.25); font-size: 14px; }
.note .ic { color: var(--orange-400); margin-top: 2px; }
.note b { color: var(--text); }

/* Chiffres cles */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--r-card); background: var(--bg-800); border: 1px solid var(--line-soft); min-width: 0; }
.stat-ic { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--orange-400); }
.stat-ic .ic { width: 22px; height: 22px; }
.stat > div:last-child { min-width: 0; }
.stat-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat-value { display: block; font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.stat.is-online .stat-ic { background: rgba(60, 179, 113, 0.14); color: var(--ok); }
.stat.is-offline .stat-ic { background: rgba(230, 57, 70, 0.14); color: var(--err); }

/* ------------------------------------------------------------ Tableaux */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .actions .btn { margin-left: 4px; }
.table td.details { max-width: 420px; color: var(--text-2); }
.card:not(.flush) .table th:first-child, .card:not(.flush) .table td:first-child { padding-left: 0; }
.who { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.who b { display: block; color: var(--text); }
.who small { display: block; color: var(--muted); }
a.who:hover b { color: var(--orange-400); }
.avatar { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--bg-700); border: 1px solid var(--line); color: var(--gold-300); font-size: 13px; font-weight: 700; }
.avatar.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--bg-700); color: var(--text); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.pager-n { font-size: 13px; color: var(--muted); }

/* Pastilles */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 9999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--bg-700); color: var(--text-2); }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge .ic { width: 13px; height: 13px; }
.badge.ok { background: rgba(60, 179, 113, 0.14); color: #7ddba4; }
.badge.err { background: rgba(230, 57, 70, 0.14); color: #ff8a93; }
.badge.warn { background: rgba(255, 193, 7, 0.14); color: var(--gold-300); }
.badge.muted { color: var(--muted); }

/* Fil d'actions */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed b { color: var(--text); }
.feed-meta { flex-shrink: 0; color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------------ Formulaires */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
input[type="text"], input[type="search"], input[type="number"], input[type="date"], select, textarea {
    width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--r); border: 1px solid var(--line);
    background: var(--bg-900); color: var(--text); font-size: 14px; transition: border-color 150ms, box-shadow 150ms;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange-700); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type="date"] { color-scheme: dark; }
.form-error { color: #ff8a93; font-size: 13.5px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.check input, .tick input { width: 18px; height: 18px; accent-color: var(--orange); cursor: pointer; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar.compact { justify-content: flex-start; }
.toolbar .field.inline { flex-direction: row; }
.toolbar select { width: auto; }
.search { position: relative; flex: 1 1 320px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; }

/* ------------------------------------------------------------ Fiches */
.hero-card { display: flex; align-items: center; gap: 18px; }
.hero-avatar { width: 72px; height: 72px; border-radius: 18px; flex-shrink: 0; object-fit: cover; }
.hero-main { min-width: 0; }
.hero-main h2 { font-size: 22px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hero-main h2 small { font-size: 14px; font-weight: 500; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 8px; font-size: 14px; }
.hero-meta > span, .hero-meta > a { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .ic { width: 16px; height: 16px; color: var(--muted); }
.hero-meta > a .ic { color: currentColor; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 14px; }
.kv.two { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.money-row { display: flex; flex-wrap: wrap; gap: 12px; }
.money { flex: 1 1 105px; padding: 12px 14px; border-radius: var(--r); background: var(--bg-900); border: 1px solid var(--line-soft); }
.money span { display: block; font-size: 12.5px; color: var(--muted); }
.money b { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.inv { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.inv li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: var(--r); background: var(--bg-900); border: 1px solid var(--line-soft); font-size: 13.5px; }
.inv-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv b { color: var(--text); font-variant-numeric: tabular-nums; flex-shrink: 0; }
/* Cartes en petit nombre (lots de la boutique, personnages) : disposition
   flexible plutot qu'une grille. Chaque carte part de 260 px et grandit
   jusqu'a 400 px avec la place disponible : sur un grand ecran, quatre lots
   remplissent la rangee au lieu de rester etroits a cote de colonnes vides,
   et une carte seule ne s'etire pas sur toute la page. (Une grille auto-fit
   avec un maximum compterait ses colonnes d'apres ce maximum, donc en
   ferait trop peu sur un ecran moyen.) */
.char-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.char-grid > * { flex: 1 1 260px; max-width: 400px; }
.char-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--bg-900); border: 1px solid var(--line-soft); text-decoration: none; transition: border-color 150ms; }
.char-card:hover { border-color: var(--orange-700); }
.char-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.char-body b { color: var(--text); }
.char-body small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ Etats, messages */
.empty { padding: 18px 20px; color: var(--muted); font-size: 14px; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 64px 20px; gap: 10px; }
.empty-state.small { padding: 44px 20px; }
.empty-state h2 { font-size: 18px; }
.empty-state .btn { margin-top: 10px; }
.empty-ic { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); color: var(--orange-400); }
.empty-ic .ic { width: 26px; height: 26px; }
.flash { padding: 11px 14px; border-radius: var(--r); font-size: 14px; border: 1px solid; }
.flash.ok { background: rgba(60, 179, 113, 0.1); border-color: rgba(60, 179, 113, 0.35); color: #9be3b9; }
.flash.warn { background: rgba(255, 193, 7, 0.08); border-color: rgba(255, 193, 7, 0.3); color: var(--gold-300); }
.flash.err, .flash.error { background: rgba(230, 57, 70, 0.1); border-color: rgba(230, 57, 70, 0.35); color: #ff9aa2; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r);
    background: var(--bg-700); border: 1px solid var(--line); color: var(--text); font-size: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); animation: toastIn 220ms var(--ease);
}
.toast::before { content: ''; flex-shrink: 0; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--info); }
.toast.ok::before { background: var(--ok); }
.toast.err::before { background: var(--err); }
.toast.wait::before { background: var(--gold); animation: pulse 1s ease-in-out infinite; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: 0.35; } }

.modal { border: 0; padding: 0; background: transparent; color: inherit; width: min(460px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(5, 3, 2, 0.72); }
.modal-box { display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: var(--r-card); background: var(--bg-800); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.modal-box h2 { font-size: 18px; }
.modal-text { color: var(--text-2); font-size: 14.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ------------------------------------------------------------ Connexion */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
    background: radial-gradient(ellipse 70% 55% at 50% 100%, rgba(255, 140, 0, 0.28), transparent 70%), var(--bg-900); }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 32px 28px; border-radius: 16px; background: var(--bg-800); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.auth-logo { width: 150px; height: auto; filter: drop-shadow(0 12px 28px rgba(255, 140, 0, 0.3)); }
.auth-card h1 { font-family: var(--font-display); font-weight: 400; font-size: 40px; letter-spacing: 0.04em; line-height: 1; }
.auth-sub { font-size: 14.5px; }
.auth .flash { width: 100%; text-align: left; }

/* ------------------------------------------------------------ Responsive */
/* Tres grands ecrans (1440p, 4K) : plus de largeur utile et un peu plus
   d'air, sans changer la taille du texte (c'est le reglage d'echelle du
   systeme qui s'en charge). */
@media (min-width: 1900px) {
    .content { max-width: 1720px; padding: 32px 40px 56px; gap: 22px; }
    .topbar { padding: 12px 40px; }
}
@media (max-width: 1200px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .layout-side { grid-template-columns: 1fr; }
    .col-side { position: static; }
    .kv.two { grid-template-columns: max-content minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform 200ms var(--ease); box-shadow: 20px 0 40px rgba(0, 0, 0, 0.5); }
    .sidebar.open { transform: none; }
    .nav-toggle { display: inline-grid; }
    .topbar { padding: 10px 16px; }
    .content { padding: 18px 16px 40px; }
    .grid-2 { grid-template-columns: 1fr; }
    .user-chip .who { display: none; }
}
@media (max-width: 560px) {
    .stats { grid-template-columns: 1fr; }
    .row { grid-template-columns: 1fr; }
    /* Le bouton de suppression pousserait la page en largeur : il passe
       dessous, sur toute la largeur. */
    .hero-card { align-items: flex-start; flex-wrap: wrap; }
    .hero-actions { margin-left: 0; width: 100%; }
    .hero-actions .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ------------------------------------------------------------ Onglets, filtres, pastilles */
.text { color: var(--text); }
.badge.info { background: rgba(79, 163, 209, 0.14); color: #8cc8e8; }
.badge.tx { background: rgba(155, 89, 182, 0.16); color: #d2a8ea; }
.badge.lib { background: rgba(255, 255, 255, 0.06); color: var(--text-2); }
.log-table .tag { font-size: 11.5px; padding: 1px 6px; margin-right: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); }
.tabs a { padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--orange); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chips a { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 9999px; border: 1px solid var(--line-soft); background: var(--bg-800); color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 600; }
.chips a:hover { border-color: var(--line); color: var(--text); }
.chips a[aria-current="true"] { background: var(--accent-soft); border-color: rgba(255, 140, 0, 0.4); color: var(--text); }
.chips a b { color: var(--muted); font-variant-numeric: tabular-nums; }
.chips .card-note { margin-left: 6px; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--bg-900); border: 1px solid var(--line-soft); }
.seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--bg-700); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.log-table td.details { max-width: 640px; }

/* ============================================================ Justice
   Ce qui precede reprend le panel (memes jetons, memes composants) ;
   la suite est propre au site de la justice. */

.side-foot { display: flex; gap: 8px; align-items: flex-start; margin: auto 0 0; padding: 10px 12px; border-radius: var(--r); background: var(--bg-800); border: 1px solid var(--line-soft); font-size: 12px; line-height: 1.45; color: var(--muted); }
.side-foot .ic { width: 15px; height: 15px; margin-top: 1px; color: var(--orange-400); }
a.stat { text-decoration: none; transition: border-color 150ms; }
a.stat:hover { border-color: var(--orange-700); }
.plink { color: var(--text); font-weight: 600; text-decoration: none; }
.plink:hover { color: var(--orange-400); text-decoration: underline; text-underline-offset: 3px; }
.avatar.round { border-radius: 50%; }
.text { color: var(--text); }
.pad { padding: 0 20px 14px; }
.note.danger { background: rgba(230, 57, 70, 0.1); border-color: rgba(230, 57, 70, 0.35); }
.note.danger .ic { color: #ff8a93; }
.hero-flags { margin-top: 10px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); line-height: 1.6; }
.subject { display: inline-flex; align-items: center; gap: 10px; }
.subject > .ic { color: var(--muted); }
kbd { font: 700 11.5px var(--mono); padding: 2px 6px; border-radius: 5px; background: var(--bg-900); border: 1px solid var(--line); color: var(--text); }

/* Casier : un bloc par rapport */
.records { list-style: none; margin: 0; padding: 0; }
.record { display: flex; flex-direction: column; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.record:last-child { border-bottom: 0; }
.record.expunged { opacity: 0.62; }
.record-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.record-date { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.record-f { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.record-tot { margin-left: auto; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.record-tot.muted { color: var(--muted); }
.table.charges { font-size: 13.5px; background: var(--bg-900); border-radius: var(--r); }
.table.charges td, .table.charges th { padding: 8px 12px; }

/* Rapport */
.report-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.report-head h2 { font-size: 20px; }
.charge-group { padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.charge-group:last-of-type { border-bottom: 0; }
.charge-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 10px; }

/* Audiences */
.hearings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hearing { display: flex; gap: 14px; padding: 12px 14px; border-radius: var(--r); background: var(--bg-900); border: 1px solid var(--line-soft); }
.hearing.cancelled { opacity: 0.55; }
.date-block { width: 54px; flex-shrink: 0; align-self: flex-start; display: flex; flex-direction: column; align-items: center; padding: 8px 0; border-radius: 10px; background: var(--accent-soft); }
.date-block b { font-size: 22px; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.date-block span { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--orange-400); }
.hearing-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.hearing-h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hearing-h b { color: var(--text); }
.hearing .hero-meta { margin-top: 0; }

/* Connexion, choix du personnage, tablette */
.auth-note { font-size: 13px; color: var(--muted); }
.auth-sub b { color: var(--text); }
.char-pick { width: 100%; display: flex; flex-direction: column; gap: 8px; }
button.char-card { width: 100%; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.char-card > .ic { color: var(--muted); }
.tab-wait { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 6px 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--bg-700); border-top-color: var(--orange); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.filter-empty { text-align: center; }

/* Mandats : decision du juge, audiences */
input[type="datetime-local"] { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--r); border: 1px solid var(--line);
    background: var(--bg-900); color: var(--text); font-size: 14px; color-scheme: dark; }
input[type="datetime-local"]:focus { outline: none; border-color: var(--orange-700); box-shadow: 0 0 0 3px var(--accent-soft); }
.decide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px; border-radius: var(--r);
    background: var(--bg-900); border: 1px solid var(--line-soft); }
.decide-form { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.decide-form .btn { align-self: flex-start; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input[type="text"] { flex: 1 1 240px; width: auto; }
.hearing-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.hero-actions { margin-left: auto; }
a.note { text-decoration: none; transition: border-color 150ms; }
a.note:hover { border-color: rgba(255, 140, 0, 0.55); }
.stat.is-pending .stat-ic { background: rgba(255, 193, 7, 0.16); color: var(--gold); }
.form-card { max-width: 820px; }
.autocomplete { position: relative; }
.ac-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
    background: var(--bg-700); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
.ac-list li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.ac-list li:hover, .ac-list li:focus { background: var(--accent-soft); outline: none; }
.ac-list b { color: var(--text); font-size: 14px; }
.ac-list small { color: var(--muted); }

/* Dans la tablette en jeu (site encadre par la NUI) : pas de connexion
   Discord possible, la tablette reconnecte le personnage elle-meme. */
html.in-tablet .web-only { display: none !important; }
html:not(.in-tablet) .tablet-only { display: none !important; }

@media (max-width: 560px) {
    .record-date, .record-tot { margin-left: 0; }
    .decide { grid-template-columns: 1fr; }
}
