/* ==========================================================================
   Multiconnexion — Thème « Admin unifié »
   Repris du design admin de D-Sound et D-Movie (help/admin-unified.html,
   helps/D-MovieAdmin.html, et leur theme-unified.css respectif).

   Couche de surcharge : chargée APRÈS design.css (maquette) et app.css.
   Retirer la balise <link> dans index.html suffit à revenir au rendu maquette.

   Palette et mesures :
     fond crème #f2efe8 · surfaces #fffdf8 · filets #e2dacb / #ece7dd
     encre #1b1f26 · texte secondaire #6f7681 · sourdine #8b8375 / #a49b8c
     rail #161a20 · rail actif #333e4d · texte rail #98a0ac
     accent Multiconnexion : vert #1f6f5c (teinte du hub dans le mockup)
     pastilles 999px · cartes 18px · typo Instrument Sans
   ========================================================================== */

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('fonts/InstrumentSans-latin.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('fonts/InstrumentSans-latin-ext.woff2') format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   0. Jetons : on redéfinit ceux de la maquette (design.css) pour reskinner
      d'un coup tout ce qui les consomme, puis on ajoute ceux du rail.
   -------------------------------------------------------------------------- */
:root {
  --bg: #f2efe8;
  --panel: #fffdf8;
  --panel-2: #f9f5ec;
  --panel-3: #f4efe4;
  --line: #e2dacb;
  --line-soft: #ece7dd;
  --line-strong: #d8cfbd;
  --ink: #1b1f26;
  --ink-2: #6f7681;
  --ink-3: #8b8375;
  --ink-4: #a49b8c;

  /* Teinte Multiconnexion : une seule variable à changer pour reteinter. */
  --accent: #1f6f5c;
  --accent-dark: #14493c;
  --accent-soft: #e7f1e9;
  --accent-ink: #14493c;

  --ok: #2f7a52;
  --ok-bg: #e7f1e9;
  --ok-ink: #276244;
  --ok-line: #c9e0d1;
  --warn: #b0740f;
  --warn-bg: #f9f0dc;
  --warn-ink: #8a5209;
  --warn-line: #ead9b4;
  --err: #b3372b;
  --err-bg: #fbe9e5;
  --err-ink: #a32e22;
  --err-line: #eec6be;

  --rail: #161a20;
  --rail-edge: #232a34;
  --rail-soft: #1f2530;
  --rail-active: #333e4d;
  --rail-border: #45515f;
  --rail-text: #98a0ac;
  --rail-text-on: #fffdf8;
  --rail-sub: #7e8794;
  --rail-w: 264px;

  --shadow-sm: none;
  --shadow-md: 0 8px 20px -10px rgba(27, 31, 38, 0.35);
  --shadow-pop: 0 28px 60px -18px rgba(20, 24, 31, 0.45), 0 2px 8px rgba(20, 24, 31, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --pill: 999px;
  --font: 'Instrument Sans', 'Helvetica Neue', system-ui, -apple-system, sans-serif;
}

/* --------------------------------------------------------------------------
   1. Base
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
}
::selection {
  background: #e6ded0;
}
::placeholder {
  color: var(--ink-4);
}
a {
  color: var(--accent);
}
a:hover {
  color: var(--accent-dark);
}
input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--accent);
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-color: var(--bg);
}

.app {
  grid-template-columns: var(--rail-w) 1fr;
}

/* --------------------------------------------------------------------------
   2. Rail de navigation (sombre, filet d'accent en haut, carte de marque)
   -------------------------------------------------------------------------- */
.sidebar {
  background: var(--rail);
  border-right: 1px solid var(--rail-edge);
  color: var(--rail-text);
  padding: 20px 14px 14px;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}
.sidebar .brand {
  min-height: 60px;
  gap: 12px;
  padding: 10px;
  background: var(--rail-active);
  border: 1px solid var(--rail-border);
  border-radius: 14px;
}
.sidebar .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #333b46;
  background: repeating-linear-gradient(135deg, #242c36, #242c36 5px, #1a2029 5px, #1a2029 10px);
  color: #c9d0d9;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
}
.sidebar .brand-name {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.1;
  color: #f7f4ee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar .brand-sub {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rail-sub);
  margin-top: 2px;
}

.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #6d7583;
  padding: 0 10px 8px;
}
.nav {
  gap: 2px;
}
.nav-item {
  position: relative;
  min-height: 40px;
  padding: 9px 12px 9px 16px;
  border-radius: 10px;
  color: var(--rail-text);
  font-size: 13.5px;
}
.nav-item:hover {
  background: var(--rail-soft);
  color: var(--rail-text-on);
}
.nav-item.active {
  background: var(--rail-active);
  color: var(--rail-text-on);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 50%;
  margin-top: -10px;
  width: 3px;
  height: 20px;
  border-radius: 2px;
  background: var(--accent);
}
.nav-item.on:not(.active) {
  color: var(--rail-text-on);
}
.nav-icon {
  opacity: 0.9;
}
.nav-count {
  background: var(--rail-soft);
  color: var(--rail-text);
  border: 1px solid var(--rail-edge);
  font-weight: 600;
}
.nav-item.active .nav-count {
  background: var(--rail-border);
  color: var(--rail-text-on);
}

.sidebar-footer {
  padding: 12px 10px 10px;
  gap: 12px;
  border-top: 1px solid var(--rail-edge);
}
.sidebar-footer > div {
  flex: 1 1 auto;
}
.sidebar-footer .avatar {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-radius: 50%;
  background: var(--rail-active);
  border: 1px solid var(--rail-border);
  color: #f7f4ee;
  font-size: 12px;
}
.me-name {
  color: #f7f4ee;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me-role {
  color: var(--rail-sub);
  font-size: 12px;
}
.me-logout {
  color: var(--rail-text);
  border-radius: var(--pill);
  padding: 6px;
  flex: 0 0 auto;
}
.me-logout:hover {
  color: var(--rail-text-on);
  background: var(--rail-soft);
}

/* --------------------------------------------------------------------------
   3. Barre supérieure + en-tête éditorial de page
   -------------------------------------------------------------------------- */
.main {
  padding: 0 32px 64px;
  background: var(--bg);
}
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -32px 28px;
  padding: 0 32px;
  min-height: 72px;
  gap: 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-brand .mark {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--ink-3);
  display: grid;
  place-items: center;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
}
.topbar-brand .name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.topbar-brand .sep {
  color: var(--ink-4);
}
.topbar-brand .crumb {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-head {
  max-width: 1560px;
}
.page-head .eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.page-head h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.015em;
}
.page-head .sub {
  margin-top: 10px;
  max-width: 660px;
  font-size: 14.5px;
  color: var(--ink-2);
}

.search {
  border-radius: var(--pill);
  padding: 8px 16px;
  min-width: 320px;
  background: var(--panel);
  border-color: var(--line);
}
.search:focus-within {
  border-color: var(--ink);
  box-shadow: none;
}
.search input {
  font-size: 13.5px;
}
.search .kbd {
  border-radius: 6px;
  font-family: var(--font);
  font-size: 11px;
}

.toolbar {
  padding: 22px 0 22px;
}
.toolbar .sub {
  color: var(--ink-2);
  font-size: 14px;
  max-width: 760px;
}

/* --------------------------------------------------------------------------
   4. Boutons, segments, pastilles
   -------------------------------------------------------------------------- */
.btn {
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
.btn:hover {
  background: var(--panel);
  border-color: var(--ink);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--rail-text-on);
}
.btn.primary:hover {
  filter: none;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn.ghost:hover {
  background: var(--panel-3);
  border-color: transparent;
  color: var(--ink);
}
.btn.danger {
  background: var(--err-bg);
  border-color: var(--err-line);
  color: var(--err-ink);
}
.btn.danger:hover {
  background: var(--err);
  border-color: var(--err);
  color: var(--panel);
}
.btn.sm {
  min-height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
}
.btn.on,
.btn.ghost.on {
  background: var(--accent-soft);
  border-color: var(--ok-line);
  color: var(--accent-ink);
}
.btn.proj:hover {
  filter: brightness(0.92);
}

.seg {
  border-radius: var(--pill);
  padding: 3px;
  background: var(--panel);
  border-color: var(--line);
}
.seg button {
  min-height: 28px;
  padding: 0 12px;
  border-radius: var(--pill);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.seg button.on {
  background: var(--accent);
  color: var(--rail-text-on);
}
.seg button:not(.on):hover {
  background: var(--panel-3);
  color: var(--ink);
}

.filter-pill {
  font-weight: 600;
}
.filter-pill.on {
  background: var(--accent-soft);
  border-color: var(--ok-line);
  color: var(--accent-ink);
}

.status,
.badge {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--panel-3);
  border-color: var(--line);
  color: var(--ink-2);
}
.status.connected {
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok-ink);
}
.status.error {
  background: var(--err-bg);
  border-color: var(--err-line);
  color: var(--err-ink);
}
.status.draft {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}
.status.connected::before {
  background: var(--ok);
}
.status.error::before {
  background: var(--err);
}
.status.draft::before {
  background: var(--warn);
}
.badge.admin {
  background: var(--accent-soft);
  border-color: var(--ok-line);
  color: var(--accent-ink);
}
.badge.off {
  background: var(--err-bg);
  border-color: var(--err-line);
  color: var(--err-ink);
}

/* --------------------------------------------------------------------------
   5. Sections, accès rapide, raccourcis globaux
   -------------------------------------------------------------------------- */
.section-head {
  margin: 26px 0 12px;
}
.section-head h2 {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}
.section-head .sep {
  background: var(--line-soft);
}

.quick-launch .ql {
  min-height: 38px;
  padding: 4px 14px 4px 5px;
  box-shadow: none;
}
.quick-launch .ql:hover {
  transform: none;
  border-color: var(--proj-color, var(--ink));
  background: var(--panel);
}
.quick-launch .ql .logo {
  border-radius: 50%;
  /* `.logo` porte un flex-basis de 38px : sans cela la pastille est ovale et l'image écrasée. */
  flex-basis: 26px;
}
/* Un logo image garde son carré arrondi : le cercle en rognerait les coins. */
.quick-launch .ql .logo.has-img {
  border-radius: 8px;
}

.shortcut {
  border-radius: 14px;
  border-color: var(--line-soft);
}
.shortcut:hover {
  border-color: var(--ok-line);
  background: var(--accent-soft);
}
.shortcut-ic {
  border-radius: 9px;
  background: var(--panel-3);
}
.shortcut:hover .shortcut-ic {
  background: var(--panel);
  color: var(--accent-ink);
}

/* --------------------------------------------------------------------------
   6. Vignettes projet
   -------------------------------------------------------------------------- */
.card {
  padding: 18px;
  gap: 12px;
  border-radius: var(--radius);
}
.card::before {
  height: 4px;
  opacity: 1;
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.compact .card {
  padding: 12px;
}
.large .card {
  padding: 22px;
}
.logo {
  border-radius: 12px;
}
.compact .logo {
  border-radius: 9px;
}
.large .logo {
  border-radius: 14px;
}
/* Logo image : remplit la pastille, coins hérités, aucun fond coloré derrière. */
.logo.has-img {
  background: transparent;
  overflow: hidden;
}
.logo.has-img img {
  display: block;
  width: 100%;
  height: 100%;
  /* `contain` : le logo est toujours visible en entier, jamais rogné. */
  object-fit: contain;
  border-radius: inherit;
}
.card-title {
  font-size: 16px;
  letter-spacing: -0.01em;
}
.large .card-title {
  font-size: 18px;
}
.card-url {
  font-size: 12px;
}

.default-user {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border-color: var(--line-soft);
}
.card .default-user:hover {
  border-color: var(--ok-line);
  background: var(--accent-soft);
}
.default-user .du-switch {
  border-radius: var(--pill);
  font-weight: 600;
}
.default-user .du-switch:hover {
  border-color: var(--ink);
}

.card-shortcut {
  border-radius: var(--radius-sm);
  border-color: var(--line-soft);
  padding: 8px 10px;
}
.card-shortcut .cs-ic {
  border-radius: 7px;
}
.card-shortcut.add {
  background: transparent;
}
.cs-admin {
  font-weight: 600;
}

.card-actions .btn {
  min-height: 34px;
}

.pin,
.card .card-size {
  border-radius: var(--pill);
}
.pin:hover {
  background: var(--panel-3);
}
.card .card-size {
  padding: 0 8px;
}

/* --------------------------------------------------------------------------
   7. Listes (vue liste, administration, comptes)
   -------------------------------------------------------------------------- */
.list {
  border-radius: var(--radius);
}
.list-row {
  border-top-color: var(--line-soft);
}
.list-row:hover {
  background: var(--panel-2);
}
.list-row .row-title {
  font-weight: 600;
}

/* Les tableaux d'administration deviennent une seule carte à rangées séparées par un filet. */
.table {
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.table .list-row {
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  padding: 14px 18px;
}
.table .list-row:first-child {
  border-top: 0;
}
.table .row-meta {
  color: var(--ink-2);
}
.table .list-row::before {
  width: 4px;
}

.accounts-block .list-row {
  border-radius: var(--radius-sm);
  border-color: var(--line-soft);
}

.pgroup {
  border-radius: var(--radius);
}
.pgroup.open .pgroup-head {
  border-bottom-color: var(--line-soft);
}
.pgroup-head .nm {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   8. Modales, formulaires, bandeaux
   -------------------------------------------------------------------------- */
.modal-overlay {
  background: rgba(27, 31, 38, 0.38);
}
.modal {
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.modal-head {
  padding: 18px 22px;
}
.modal-head h3 {
  font-size: 20px;
  letter-spacing: -0.01em;
}
.modal-head .x {
  border-radius: var(--pill);
}
.modal-head .x:hover {
  background: var(--panel-3);
}
.modal-body {
  padding: 18px 22px;
}
.modal-foot {
  padding: 14px 22px;
  background: var(--panel-2);
  border-top-color: var(--line-soft);
}
.modal-sub {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.field input,
.field select {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--pill);
  font-size: 13.5px;
}
.field input:focus,
.field select:focus {
  border-color: var(--ink);
  box-shadow: none;
}
.field input[type='checkbox'] {
  min-height: 0;
}
.swatch {
  border-radius: 50%;
}

.user-row {
  border-radius: var(--radius-sm);
}
.user-row.is-default {
  border-color: var(--ok-line);
  background: var(--accent-soft);
}
.user-row .default-tag {
  border-radius: var(--pill);
  border-color: var(--ok-line);
  background: var(--panel);
}
.user-row.admin .badge {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.user-row .badge {
  font-weight: 600;
}

.hint {
  font-size: 12.5px;
}
.hint.warn {
  color: var(--warn-ink);
  background: var(--warn-bg);
  border-color: var(--warn-line);
  border-radius: 14px;
  padding: 12px 16px;
}
.cred code {
  border-radius: 10px;
  background: var(--panel-3);
}
.details summary {
  font-weight: 600;
}

.impersonation-banner {
  background: var(--warn-bg);
  border-bottom-color: var(--warn-line);
  color: var(--warn-ink);
  font-weight: 500;
}
.impersonation-banner .btn {
  border-color: var(--warn-line);
}

.toast {
  border-radius: var(--pill);
  padding: 10px 18px;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
}
.empty {
  color: var(--ink-3);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* --------------------------------------------------------------------------
   9. Écran de connexion
   -------------------------------------------------------------------------- */
.login-screen {
  background:
    radial-gradient(900px 520px at 15% -10%, #e6ded0 0%, transparent 60%),
    radial-gradient(700px 420px at 100% 110%, var(--accent-soft) 0%, transparent 55%), var(--bg);
}
.login-card {
  max-width: 400px;
  padding: 30px 30px 26px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.login-card .brand {
  gap: 12px;
  padding: 0 0 16px;
}
.login-card .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  font-size: 15px;
}
.login-card .brand-name {
  font-size: 22px;
  letter-spacing: -0.015em;
}
.login-card .brand-sub {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.login-intro {
  font-size: 14px;
  margin-bottom: 20px;
}
.login-submit {
  min-height: 42px;
  margin-top: 10px;
}
.login-error {
  color: var(--err-ink);
}

/* --------------------------------------------------------------------------
   10. Petits écrans : le rail passe au-dessus du contenu
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .main {
    padding: 0 16px 48px;
  }
  .header {
    margin: 0 -16px 20px;
    padding: 10px 16px;
    flex-wrap: wrap;
  }
  .search {
    min-width: 0;
    width: 100%;
  }
  .page-head h1 {
    font-size: 30px;
  }
}
