/* Espace admin : menu latéral sur grand écran, barre du bas sur mobile. */
.adm { --side: 252px; background: radial-gradient(1000px 600px at 70% -10%, #0f3a43 0%, #0a2a30 55%) fixed, #0a2a30; }
.adm-shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

/* ----- Navigation ----- */
.adm .adm-nav {
  display: flex; flex-direction: column; gap: .2rem; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  padding: 1rem .8rem 1.2rem; background: rgba(5, 24, 28, .88); border-right: 1px solid var(--line); margin: 0;
  overflow-x: hidden; scrollbar-width: thin;
}
.adm-brand { display: flex; align-items: center; gap: .7rem; padding: .3rem .5rem 1rem; color: var(--ivoire); text-decoration: none; }
.adm-brand b { display: block; font: 700 1.25rem var(--serif); line-height: 1.1; }
.adm-brand small { display: block; color: var(--craie); font-size: .82rem; }
.adm-grp { display: flex; flex-direction: column; gap: .15rem; margin-bottom: .6rem; }
.adm-grp-title { margin: .6rem .6rem .2rem; font-size: .8rem; color: var(--craie); opacity: .8; }
.adm .adm-nav button {
  position: relative; display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 44px; padding: 0 .8rem;
  border-radius: 10px; border: 0; background: transparent; color: var(--craie); font: 600 .97rem var(--sans); text-align: left; cursor: pointer;
}
.adm .adm-nav button svg { flex: 0 0 auto; opacity: .9; }
.adm .adm-nav button:hover { background: rgba(243, 234, 213, .07); color: var(--ivoire); }
.adm .adm-nav button.active { background: rgba(217, 164, 65, .15); color: var(--laiton-2); }
.adm .adm-nav button.active::before { content: ""; position: absolute; left: -.8rem; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--laiton); }
.adm .adm-nav .badge { margin-left: auto; min-width: 22px; padding: 0 .4rem; border-radius: 999px; background: var(--argile); color: #fff; font: 700 .78rem var(--sans); text-align: center; }
.adm-morebtn { display: none !important; }
.adm-sheet { display: contents; }
.adm-leave { margin-top: auto; padding: .8rem .6rem 0; color: var(--craie); text-decoration: none; font-weight: 600; }
.adm-leave:hover { color: var(--ivoire); }
.adm-top { display: none; }

/* ----- Contenu ----- */
.adm-content { padding: 1.6rem clamp(1rem, 3vw, 2.4rem) 3rem; max-width: 1120px; width: 100%; }
.adm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.adm-head h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 0 0 .15rem; }
.adm-head p { margin: 0; max-width: 60ch; }
.adm-content h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; font-family: var(--sans); font-weight: 700; color: var(--ivoire); }
.adm-content .panel { margin-bottom: .9rem; }
.adm-content .panel h2:first-child { margin-top: 0; }

/* ----- Vue d'ensemble ----- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.1rem; border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(180deg, rgba(18, 65, 74, .7), rgba(13, 50, 57, .7)); color: var(--ivoire); text-align: left; font: inherit; cursor: pointer; }
.kpi:hover { border-color: var(--craie); }
.kpi span { color: var(--craie); font-size: .92rem; }
.kpi strong { font: 700 2rem/1.1 var(--serif); color: var(--laiton-2); font-variant-numeric: tabular-nums; }
.kpi small { color: var(--craie); font-size: .85rem; }
.kpi.alert { border-color: rgba(194, 69, 45, .7); background: linear-gradient(180deg, rgba(110, 40, 28, .55), rgba(13, 50, 57, .7)); }
.kpi.alert strong { color: #ffb09c; }
.home-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; align-items: start; }
.todo, .mini-tables { list-style: none; margin: 0; padding: 0; }
.todo li, .mini-tables li { display: flex; align-items: center; gap: .7rem; justify-content: space-between; padding: .65rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.todo li:first-child, .mini-tables li:first-child { border-top: 0; }
.todo .ok { color: #8be6ac; }

/* ----- Joueurs ----- */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: .6rem; }
.toolbar input[type=search] { flex: 1 1 220px; }
.toolbar select { flex: 0 1 200px; width: auto; }
.seg.small { margin: 0; overflow-x: auto; scrollbar-width: none; }
.seg.small::-webkit-scrollbar { display: none; }
.pl-row > * { min-width: 0; }
.seg.small span { min-height: 40px; padding: .4rem .85rem; font-size: .93rem; }
.pl-list { display: flex; flex-direction: column; gap: .5rem; }
.pl-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) 120px 140px minmax(280px, 1.5fr); gap: .8rem 1rem; align-items: center; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--r); background: rgba(13, 50, 57, .6); }
.pl-row.banned { opacity: .7; border-color: rgba(194, 69, 45, .5); }
.pl-id { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.av { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 700 1.1rem var(--serif); background: var(--cuir-2); color: var(--laiton-2); border: 1px solid #7a5232; }
.pl-id strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-id small { display: block; color: var(--craie); font-size: .84rem; }
.pl-bal { display: flex; flex-direction: column; line-height: 1.2; }
.pl-bal span { color: var(--craie); font-size: .82rem; }
.pl-bal b { font: 700 1.25rem var(--serif); font-variant-numeric: tabular-nums; }
.pl-role select { min-height: 40px; }
.pl-cred { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.pl-cred .cred-main { display: flex; flex-wrap: wrap; gap: .4rem; flex: 1 1 auto; align-items: center; }
.pl-cred input { width: 110px; min-height: 40px; flex: 1 1 90px; min-width: 90px; }
.pl-cred .quick { display: flex; gap: .3rem; }
.pl-cred .quick button { min-height: 32px; padding: 0 .55rem; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--craie); font: 600 .82rem var(--sans); cursor: pointer; }
.pl-cred .quick button:hover { color: var(--ivoire); border-color: var(--craie); }
.pl-ban { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 1.2rem; margin-top: -.4rem; }
.pl-ban .btn-link { min-height: 28px; padding: 0; font-size: .88rem; }
.ban-tag { background: rgba(194, 69, 45, .3); color: #ffb09c; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; margin-left: .3rem; }

/* ----- Tables ----- */
.tb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 470px), 1fr)); gap: .9rem; align-items: start; }
.tb-card { margin: 0 !important; display: flex; flex-direction: column; gap: .7rem; }
.tb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; flex-wrap: wrap; }
.tb-head h3 { margin: 0; font: 700 1.15rem var(--serif); }
.tb-tags { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .25rem; }
.tb-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem .9rem; margin: 0; }
.tb-facts div { min-width: 0; }
.tb-facts dt { color: var(--craie); font-size: .8rem; }
.tb-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.tb-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tb-card .launch-box, .tb-card .endbox { margin: 0; }
.acc { border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .14); }
.acc > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: .6rem; min-height: 46px; padding: 0 .9rem; cursor: pointer; font-weight: 600; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: "▾"; color: var(--craie); transition: transform .15s; }
.acc[open] > summary::after { transform: rotate(180deg); }
.acc > summary small { color: var(--craie); font-weight: 400; margin-left: auto; margin-right: .4rem; }
.acc-body { padding: .2rem .9rem .9rem; display: flex; flex-direction: column; gap: .8rem; }
.acc-body .row-form { align-items: flex-end; }
.acc-body fieldset.access { margin: 0; }
.acc-body .plain-list li { padding: .45rem 0; display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; align-items: center; }
.tb-card .tb-del { align-self: flex-start; }

/* ----- Fenêtre de création ----- */
.adm-dlg { padding: 0; border: 1px solid var(--line); border-radius: 18px; background: #0b3037; color: var(--ivoire); width: min(780px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); overflow: hidden; }
.adm-dlg[open] { display: flex; }
.adm-dlg::backdrop { background: rgba(2, 12, 15, .72); backdrop-filter: blur(3px); }
.dlg-form { display: flex; flex-direction: column; width: 100%; min-height: 0; max-height: calc(100dvh - 2rem); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 1.3rem; font-family: var(--serif); }
.dlg-x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ivoire); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.dlg-body { flex: 1 1 auto; overflow-y: auto; padding: .4rem 1.2rem 1rem; overscroll-behavior: contain; }
.dlg-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .8rem 1.2rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(5, 24, 28, .6); }
.fs { padding: .9rem 0; border: 0; border-bottom: 1px solid var(--line); margin: 0; min-width: 0; }
.fs:last-child { border-bottom: 0; }
.fs h3, fieldset.fs legend { font: 700 1rem var(--sans); color: var(--laiton-2); margin: 0 0 .6rem; padding: 0; }
.fs h3 small { color: var(--craie); font-weight: 400; margin-left: .3rem; }
fieldset.fs { padding: .9rem 0; border-radius: 0; }
.fs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; align-items: end; }
.fs-grid .span2 { grid-column: span 2; }
.fs-grid .span3 { grid-column: 1 / -1; margin: 0; }
.fs-grid[hidden] { display: none; }
.fs-grid p { margin: 0; }

/* ----- Tableaux ----- */
.adm .grid tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .025); }
.adm .grid td.plus { color: #8be6ac; } .adm .grid td.minus { color: #ffb09c; }

/* ----- Mobile ----- */
@media (max-width: 899px) {
  .adm-shell { grid-template-columns: minmax(0, 1fr); }
  .adm-top { display: flex; align-items: center; gap: .8rem; position: sticky; top: 0; z-index: 25; padding: calc(.4rem + env(safe-area-inset-top)) 16px .4rem; background: rgba(5, 24, 28, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .adm-top-title { font: 700 1.1rem var(--serif); }
  .adm-content { padding: 1rem 16px calc(92px + env(safe-area-inset-bottom)); }
  .adm .adm-nav {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; top: auto; height: auto; overflow: visible; flex-direction: row; align-items: stretch; gap: 0;
    padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: rgba(5, 24, 28, .96); backdrop-filter: blur(10px);
  }
  .adm-brand, .adm-primary .adm-grp-title, .adm-leave { display: none; }
  .adm-primary { display: contents; }
  .adm .adm-nav > .adm-grp > button, .adm .adm-nav > .adm-morebtn { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: .1rem; min-height: 56px; padding: .2rem .1rem; font-size: .72rem; text-align: center; border-radius: 12px; }
  .adm-morebtn { display: flex !important; }
  .adm .adm-nav button.active::before { left: 25%; right: 25%; top: -.3rem; bottom: auto; width: auto; height: 3px; border-radius: 0 0 4px 4px; }
  .adm .adm-nav .badge { position: absolute; top: 2px; right: calc(50% - 26px); margin: 0; min-width: 18px; font-size: .7rem; }
  .adm-sheet { display: none; position: absolute; left: 8px; right: 8px; bottom: calc(100% + 8px); max-height: 70dvh; overflow-y: auto; padding: .6rem; border-radius: 18px; border: 1px solid var(--line); background: #0b3037; box-shadow: 0 -10px 40px rgba(0, 0, 0, .55); }
  .adm-nav.open .adm-sheet { display: block; }
  .adm-sheet .adm-grp { margin-bottom: .2rem; }
  .adm-sheet .adm-grp-title { display: block; }
  .adm .adm-sheet button { flex-direction: row; font-size: .97rem; min-height: 48px; text-align: left; }
  .adm .adm-sheet .adm-leave { display: block; }
  body.adm-sheet-open::after { content: ""; position: fixed; inset: 0; z-index: 30; background: rgba(2, 12, 15, .55); }
  .home-cols { grid-template-columns: 1fr; }
  .pl-row { grid-template-columns: 1fr auto; padding: .8rem; }
  .pl-id { grid-column: 1; }
  .pl-bal { grid-column: 2; align-items: flex-end; }
  .pl-role, .pl-cred { grid-column: 1 / -1; }
  .pl-cred input { width: auto; }
  .pl-cred .cred-main { flex: 1 1 100%; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: .8rem; } .kpi strong { font-size: 1.6rem; }
  .adm-head .btn { flex: 1 1 auto; }
  /* fenêtre de création : plein écran */
  .adm-dlg { width: 100vw; max-width: none; height: 100dvh; max-height: none; border-radius: 0; margin: 0; border: 0; }
  .dlg-form { max-height: none; height: 100%; }
  .fs-grid { grid-template-columns: 1fr 1fr; }
  .fs-grid .span2, .fs-grid .span3 { grid-column: 1 / -1; }
  .dlg-foot .btn { flex: 1; }
}
@media (max-width: 420px) { .tb-facts { grid-template-columns: 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { .acc > summary::after { transition: none; } }
.adm-content .panel.request { padding: .9rem 1.1rem; border-top: 1px solid var(--line); }
