/* Carcasse de rail partagée (/studio, plus tard /band).
   N'introduit AUCUNE variable : consomme celles de /style.css. */

.shell { display: flex; gap: 22px; align-items: flex-start; }
.shell-main { flex: 1; min-width: 0; }           /* min-width:0 = autorise le rétrécissement */

.rail {
  flex: 0 0 268px;
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.rail[hidden] { display: none; }
.rail.is-collapsed { flex-basis: 52px; }
.rail.is-collapsed .rail-block, .rail.is-collapsed .rail-title { display: none; }

.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.rail-title { font-weight: 800; font-size: 15px; color: var(--fg); }
.rail-icon {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 4px; border-radius: 8px; display: grid; place-items: center;
}
.rail-icon:hover { color: var(--fg); background: rgba(255,255,255,.05); }
.rail-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.rail-block { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.rail-block:last-child { border-bottom: none; }
.rail-block--list { flex: 1; overflow-y: auto; }
/* Un emplacement non rempli ne doit pas laisser un bloc bordé vide dans le rail :
   ex. l'emplacement « group » quand un membre n'a qu'un seul groupe (sélecteur masqué). */
.rail-block:empty { display: none; }

/* Le bouton d'ouverture n'existe qu'en mode tiroir. */
.shell-toggle { display: none; }
.shell-scrim { display: none; }

@media (max-width: 720px) {
  .shell { display: block; }

  .shell-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    background: transparent; border: 1.5px solid var(--border); color: var(--fg);
    border-radius: 11px; padding: 9px 14px; font: inherit; font-size: 14px;
    font-weight: 700; cursor: pointer; margin-bottom: 14px;
  }
  .shell-toggle:hover { border-color: var(--accent); }
  .shell-toggle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    width: min(84vw, 320px); max-height: none; border-radius: 0;
    border-width: 0 1px 0 0;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .rail.is-open { transform: translateX(0); }
  .rail.is-collapsed { flex-basis: auto; }        /* le repli ne s'applique pas au tiroir */
  .rail.is-collapsed .rail-block,
  .rail.is-collapsed .rail-title { display: revert; }

  .shell-scrim {
    display: block; position: fixed; inset: 0; z-index: 59;
    background: rgba(0,0,0,.55); opacity: 0; pointer-events: none;
    transition: opacity .22s ease;
  }
  .shell-scrim.is-open { opacity: 1; pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .rail, .shell-scrim { transition: none; }
}

/* Éléments de liste du rail */
.rail-block input[type=text] {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 9px;
  font: inherit; font-size: 13px; background: var(--bg); color: var(--fg);
}
.rail-block input[type=text]:focus { outline: none; border-color: var(--accent); }
.rail-group {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  margin: 4px 0 8px; display: flex; align-items: center; gap: 8px;
}
.rail-group::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.rail-item {
  width: 100%; text-align: left; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 10px; margin-bottom: 6px; color: var(--fg); font: inherit; font-size: 14px;
  cursor: pointer;
}
.rail-item:hover { border-color: var(--accent); }
.rail-item.is-on { border-color: var(--accent); color: var(--accent); background: rgba(55,191,165,.10); }
.rail-row { display: flex; align-items: stretch; gap: 4px; margin-bottom: 6px; }
.rail-row .rail-item { flex: 1; margin-bottom: 0; }
.rail-row.is-on .rail-item { border-color: var(--accent); color: var(--accent); background: rgba(55,191,165,.10); }
.rail-del {
  flex: 0 0 auto; width: 30px; background: var(--bg); color: var(--muted);
  border: 1px solid var(--border); border-radius: 9px; cursor: pointer;
  display: grid; place-items: center; opacity: 0; transition: opacity .15s ease;
}
.rail-row:hover .rail-del, .rail-del:focus-visible { opacity: 1; }
.rail-del:hover { color: var(--fg); border-color: var(--accent); }
.rail-del svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 720px) { .rail-del { opacity: 1; } }   /* pas de survol au doigt */
.rail-pub {
  flex: 0 0 auto; width: 30px; background: var(--bg); color: var(--muted);
  border: 1px solid var(--border); border-radius: 9px; cursor: pointer;
  display: grid; place-items: center; opacity: 0; transition: opacity .15s ease;
}
.rail-row:hover .rail-pub, .rail-pub:focus-visible { opacity: 1; }
.rail-pub:hover { color: var(--accent); border-color: var(--accent); }
.rail-pub svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 720px) { .rail-pub { opacity: 1; } }
.rail-item-name { display: flex; flex-direction: column; min-width: 0; }
.rail-item-name em { font-style: normal; font-size: 12px; color: var(--muted); }
.rail-dot { width: 7px; height: 7px; border-radius: 50%; background: #d8a13a; flex: 0 0 auto; }
.rail-empty { color: var(--muted); font-size: 13px; margin: 4px 0; }
.rail-marks { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.rail-marks svg { width: 13px; height: 13px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rail-more {
  width: 100%; background: none; border: 1px dashed var(--border); color: var(--muted);
  border-radius: 9px; padding: 7px; font: inherit; font-size: 12px; cursor: pointer;
}
.rail-more:hover { color: var(--fg); border-color: var(--accent); }

/* Sélecteur de groupe + bandeau admin (Task 3) */
.rail-lbl { display:block; font-size:12px; color:var(--muted); margin:0 0 4px; }
.rail-select { width:100%; background:var(--panel); color:var(--fg); border:1px solid var(--border);
  border-radius:9px; padding:8px 10px; font:inherit; font-size:14px; }
.rail-adminwarn { margin-top:8px; padding:8px 10px; border-radius:9px; font-size:12.5px;
  color:var(--fg); background:rgba(224,122,63,.14); border:1px solid rgba(224,122,63,.5); }

/* Outils (Task 6) */
.rail-tools { display: flex; flex-direction: column; gap: 10px; }
/* font-weight/margin explicites : neutralisent la règle globale `label` des pages
   hôtes (le Studio déclare label{font-weight:700;margin:0 0 6px}), qui sortait
   les libellés d'outils en gras avec une marge parasite. */
.rail-tool { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 400; margin: 0; }
.rail-tool input[type=range] { flex: 1; accent-color: var(--accent); }
.rail-tool input[type=checkbox] { accent-color: var(--accent); }
