/* ADMIN – sidebar layout        */
    /* ============================= */

    .adm {
      display: grid;
      grid-template-columns: 260px 1fr;
      min-height: 600px;
    }

    .adm.adm-embedded {
      display: block;
      min-height: 0;
    }

    @media (max-width: 900px) {
      .adm {
        grid-template-columns: 1fr;
      }
      .adm-sidebar {
        border-right: none !important;
        border-bottom: 1px solid var(--border);
      }
      .adm.adm-embedded {
        grid-template-columns: 1fr;
      }
    }

    /* Sidebar */
    .adm-sidebar {
      background: #10151d;
      border-right: 1px solid var(--border);
      padding: 0;
      display: flex;
      flex-direction: column;
    }

    .adm-sidebar-head {
      padding: 18px 20px 14px;
      border-bottom: 1px solid var(--border);
    }

    .adm-sidebar-head h2 {
      margin: 0;
      font-size: 18px;
      color: var(--accent);
    }

    .adm-nav {
      padding: 10px 0;
      display: flex;
      flex-direction: column;
    }

    /* Nav links */
    .adm-nav-link {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      border: none;
      background: transparent;
      color: var(--muted);
      font: inherit;
      font-size: 14px;
      padding: 10px 22px;
      cursor: pointer;
      text-align: left;
      transition: background .12s, color .12s;
    }

    .adm-nav-link:hover {
      background: rgba(255,255,255,.04);
      color: var(--text);
    }

    .adm-nav-link.active {
      background: rgba(79,156,255,.12);
      color: var(--accent);
      font-weight: 700;
    }

    .adm-nav-icon {
      font-size: 16px;
      width: 22px;
      text-align: center;
      flex-shrink: 0;
    }

    /* Group toggles */
    .adm-nav-group {
      display: flex;
      flex-direction: column;
    }

    .adm-nav-group-toggle {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      border: none;
      background: transparent;
      color: var(--text);
      font: inherit;
      font-size: 14px;
      font-weight: 700;
      padding: 10px 22px;
      cursor: pointer;
      text-align: left;
      transition: background .12s;
    }

    .adm-nav-group-toggle:hover {
      background: rgba(255,255,255,.04);
    }

    .adm-nav-chevron {
      margin-left: auto;
      font-size: 16px;
      transition: transform .2s;
      color: var(--muted);
    }

    .adm-nav-group-toggle.open .adm-nav-chevron {
      transform: rotate(90deg);
    }

    /* Submenu */
    .adm-nav-submenu {
      max-height: 0;
      overflow: hidden;
      transition: max-height .25s ease;
    }

    .adm-nav-submenu.open {
      max-height: 300px;
    }

    .adm-nav-submenu .adm-nav-link {
      padding-left: 54px;
      font-size: 13px;
    }

    /* Main */
    .adm-main {
      padding: 22px 28px;
      overflow-y: auto;
    }

    .adm-header {
      margin-bottom: 20px;
    }

    .adm-header h2 {
      margin: 0;
      font-size: 22px;
    }

    /* Views */
    .adm-view {
      display: none;
    }

    .adm-view.active {
      display: block;
    }

    /* ============================= */
    /* Shared admin components       */
    /* ============================= */

    .admin-kpis {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 16px;
      margin-bottom: 16px;
    }

    @media (max-width: 900px) {
      .admin-kpis {
        grid-template-columns: 1fr;
      }
    }

    .admin-kpi span {
      display: block;
      color: var(--muted);
      margin-bottom: 8px;
    }

    .admin-kpi strong {
      font-size: 34px;
      font-weight: 700;
    }

    .admin-layout {
      display: grid;
      grid-template-columns: 1.4fr .8fr;
      gap: 16px;
    }

    @media (max-width: 980px) {
      .admin-layout {
        grid-template-columns: 1fr;
      }
    }

    .admin-toolbar {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      margin-bottom: 12px;
    }

    .admin-input {
      flex: 1;
      min-width: 220px;
      border: 1px solid var(--border);
      background: var(--panel-2);
      color: var(--text);
      border-radius: 10px;
      padding: 12px 13px;
      outline: none;
    }

    .admin-input:focus {
      border-color: var(--accent);
    }

    .admin-table-wrap {
      overflow: auto;
    }

    .admin-table {
      width: 100%;
      border-collapse: collapse;
    }

    .admin-table th,
    .admin-table td {
      text-align: left;
      padding: 10px 12px;
      border-bottom: 1px solid var(--border);
      vertical-align: top;
      white-space: nowrap;
    }

    .admin-table th {
      color: var(--muted);
      font-weight: 700;
    }

    .admin-empty {
      color: var(--muted);
    }

    .admin-user-editor-head {
      display: grid;
      gap: 8px;
      margin-bottom: 14px;
    }

    .admin-role-checkboxes {
      display: grid;
      gap: 10px;
    }

    .admin-role-item {
      display: flex;
      gap: 12px;
      align-items: flex-start;
      padding: 10px 12px;
      border-radius: 10px;
      background: var(--panel-2);
      border: 1px solid rgba(255,255,255,.03);
      cursor: pointer;
    }

    .admin-role-item small {
      display: block;
      color: var(--muted);
      margin-top: 2px;
    }

    .admin-role-item input[disabled] {
      opacity: .4;
      cursor: not-allowed;
    }

    .admin-role-item:has(input[disabled]) {
      opacity: .55;
      cursor: not-allowed;
    }

    .adm-view .field {
      margin-bottom: 10px;
    }

    .adm-view .field label {
      display: block;
      margin-bottom: 4px;
      font-size: 13px;
      color: var(--muted);
    }

    /* Matrice permissions/rôles */
    .matrix-table {
      font-size: 13px;
    }

    .matrix-table th {
      position: sticky;
      top: 0;
      background: var(--panel);
      z-index: 1;
    }

    .matrix-cat-col {
      min-width: 100px;
    }

    .matrix-perm-col {
      min-width: 180px;
    }

    .matrix-role-col {
      text-align: center !important;
      min-width: 90px;
    }

    .matrix-cat-cell {
      font-weight: 700;
      color: var(--accent);
      vertical-align: top;
      border-right: 1px solid var(--border);
    }

    .matrix-check-cell {
      text-align: center !important;
    }

    .matrix-check-cell input[type="checkbox"] {
      width: 18px;
      height: 18px;
      cursor: pointer;
      accent-color: var(--accent);
    }

    .matrix-check-cell input[type="checkbox"][disabled] {
      opacity: .35;
      cursor: not-allowed;
    }

    /* Matrix accordion */
    .matrix-group {
      border: 1px solid var(--border);
      border-radius: 10px;
      overflow: hidden;
      margin-bottom: 8px;
    }

    .matrix-group-header {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      background: var(--panel-2);
      cursor: pointer;
      user-select: none;
      border: none;
      width: 100%;
      text-align: left;
      color: var(--text);
      font: inherit;
      font-size: 14px;
      font-weight: 700;
    }

    .matrix-group-header:hover {
      background: var(--border);
    }

    .matrix-group-chevron {
      transition: transform .2s ease;
      font-size: 12px;
      color: var(--muted);
    }

    .matrix-group.open .matrix-group-chevron {
      transform: rotate(90deg);
    }

    .matrix-group-count {
      font-weight: 400;
      font-size: 12px;
      color: var(--muted);
    }

    .matrix-group-body {
      display: none;
    }

    .matrix-group.open .matrix-group-body {
      display: block;
    }

    .matrix-group-body .admin-table-wrap {
      border-radius: 0;
    }

    .matrix-group-body .matrix-table {
      border: none;
    }

    .matrix-group-body .matrix-table thead th {
      background: var(--panel);
      font-size: 12px;
      padding: 6px 10px;
    }
